Results 1 to 4 of 4

Thread: merging two colls into one

  1. #1
    Junior Member
    Join Date
    Nov 2007
    Answers
    8

    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.




  2. #2
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    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...........


  3. #3
    Junior Member
    Join Date
    Nov 2007
    Answers
    8

    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';


  4. #4
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact