Click here to Skip to main content
15,887,393 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Here is the thing. I have created two tables called "User" and "Phone".In User table there are two columns "id" and "name".since one user has more than one phone number I've created another table called "Phone" as mentioned above. so phone table contains all the telephone numbers of each user.

User table         
id-------name       
100-----jack       
200-----john       
                   
                   
phone table
id-------phone
100-----12345
100-----23456
200-----34567
200-----45678


So now i want to load those two tables to a single grid view as below (Visual studio 2008,C#)

name-----phone       
jack-------12345,23456       
john-------34567,45678 

I wrote a query as
SQL
SELECT U.name,P.phone
FROM tUser U,tPhone P 
WHERE U.id = P.id


But I'm getting the output as below

name-----phone       
jack-------12345
jack-------23456       
john-------34567
john-------45678 

What should I do now? Is it not possible or is there any other way to get the correct output? I'm Waiting for a positive reply. Thanks..
Posted
Updated 24-Sep-11 20:03pm
v2

1 solution

 
Share this answer
 
Comments
d_lucifer 25-Sep-11 2:15am    
it's really helpful.so that means do i have to write a t-sql to get the correct output?
Mehdi Gholam 25-Sep-11 4:34am    
Yes you do.
d_lucifer 25-Sep-11 11:17am    
well then i'll try to do it.. thanks for the help. :)
I have posted same question twice.. sorry about that..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900