-
Junior Member
merging two colls into one
hi
is there a way to merge two cols in to one?
this is how my data looks:
Name Second_Name
---------------------------------------------------
Ron Dan
Dan Mike
Linda Dan
Sean Ron
Karen Dan
Dan Jane
Ron Dave
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
so it will look like that:
Names
----------
Ron
Mike
Linda
Karen
Jane
all of those are Dan's other name
I tries to create one SELECT inside the main SELECT but still it gave me two collums aventually.
anyone has an idea?
thank you.
-
Expert Member
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...........
-
Junior Member
Re: merging two colls into one
hey, thank you !!
I am using access (I forgot to mention) but there is not much of a difference is it?
(Will I have to rewrite this sql when I will move it to msSql?)
here, I'm just adding the code if anyone's interested:
Select Second_Name as userOtherName from tblUsers where Name='dan'
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 .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules