Click here to Skip to main content
15,891,647 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two tables namely tblpip and tbluse. tblpip has the following field names: fldid, fldname, fldcity. While on tbluse: user_id, job. I want to join these two tables where fldid is equal to user_id. Any help?
Posted
Updated 13-Jul-14 18:20pm
v4
Comments
PIEBALDconsult 13-Jul-14 22:26pm    
That sounds like an SQL question; not a C# or ASP.net question.
Look into the JOIN/ON syntax of your database.
DarkDreamer08 13-Jul-14 22:37pm    
Haha, Thanks for correcting me. I am using ASP.Net in this project and I forgot to change the subject. Thanks a lot PIEBALDconsult
ArunRajendra 13-Jul-14 23:45pm    
Question not clear

SQL
SELECT * FROM tblpip /* or rather the specific columns you want to expose */
JOIN tbluse ON tblpip.fldid = tbluse.user_id;
 
Share this answer
 
Comments
DarkDreamer08 14-Jul-14 1:39am    
Thanks for the answer. But why an error message showed saying, "Exception of type 'System.OutOfMemoryException' was thrown." when I try to put it in my code behind in ASP.Net. I am trying to connect in the databse so that the records will display at my gridview
Hi,

Write below query

SQL
Select t1.fldname,t1.fldcity,t2.job from tblpip t1 inner join tbluser t2 on t1.fldid = t2.user_id
 
Share this answer
 

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