merging two colls into one
hi
<br>
is there a way to merge two cols in to one?
<br>
<br>
this is how my data looks:
<br>
Name Second_Name
<br>
---------------------------------------------------
<br>
Ron Dan
<br>
Dan Mike
<br>
Linda Dan
<br>
Sean Ron
<br>
Karen Dan
<br>
Dan Jane
<br>
Ron Dave
<br>
<br>
<br>
what i want to do is merge all of Dan's second names (only where Dan appears as either a first name or a second name) to one single collum
<br>
so it will look like that:
<br>
<br>
<br>
Names
<br>
----------
<br>
Ron
<br>
Mike
<br>
Linda
<br>
Karen
<br>
Jane
<br>
<br>
all of those are Dan's other name
<br>
I tries to create one SELECT inside the main SELECT but still it gave me two collums aventually.
<br>
<br>
anyone has an idea?
<br>
thank you.
<br>
Re: merging two colls into one
Select secondname names from dummy_test where name='don' union select name names from dummy_test where secondname='don' try this...........
Re: merging two colls into one
hey, thank you !!
<br>
I am using access (I forgot to mention) but there is not much of a difference is it?
<br>
(Will I have to rewrite this sql when I will move it to msSql?)
<br><br>
here, I'm just adding the code if anyone's interested:
<br>
Select Second_Name as userOtherName from tblUsers where Name='dan'
<br>UNION
Select Name as userOtherName from tblUsers where Second_Name='dan';
Re: merging two colls into one
Run an update query by concadinating the last name with the firstname column .