Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I have created 3 tables namely a,b,c.In c i have created the datagrid view and i need to retrive the datas from a and B table i.e First column from 'a' table second and third column from 'b' table. How to retrieve it.

Regards
Balamurugan
Posted
Comments
Sushil Mate 2-Nov-12 1:54am    
I reckon, You are the most consistent OP in this forum.

by the way whats the problem?
[no name] 2-Nov-12 1:56am    
OP??????
MT_ 2-Nov-12 2:17am    
OP Stands for Original Poster, in CP (Code Project) lingo, If I am not wrong. :-)
[no name] 2-Nov-12 2:37am    
Okay.....

1 solution

considering very abstract nature of the question, the only answer I could think of is as a genralized query as below
Consider Table A, B and C are having foreign key relationship, you can write a query

SQL
select a.firstcolumn,b.secondcolumn,b.thirdcolumn
from tableA, tableB, tableC
where
tableA.primaryKeyColumn = tableB.ForeignKeyColumn
and 
tableB.PrimaryKeyColumn = tableC.ForeignKeyColumn


Replace appropriate column and table name in the query,

Hope that helps.
-Milind
 
Share this answer
 
Comments
[no name] 2-Nov-12 2:11am    
Thanks for ur coding...
MT_ 2-Nov-12 9:11am    
You unselected the answer as solution. Would you like to share reason/problem?
MT_ 2-Nov-12 2:17am    
Glad it helped!

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