Databinding 3 tables

  • Thread starter Thread starter MRW
  • Start date Start date
M

MRW

Hello!

I've been searching and searching for an answer, so hopefully, somebody
can provide a little help! [Smile]

I have a database with three tables and their fields (made nice and
simple):

tblMain: ID, DateEntered
tblSub1: SubID, ID, Title
tblSub2: SubID, ID, Title

ID is what binds tblMain to tblSub1 and tblMain to tblSub2 (there IS a
reason there are two "sub" tables, it's just made easy for this
example)

I want to display tblSub1 and tblSub2 in a DataGrid in order by their
DateEntered, which is in tblMain. I know how to use INNER JOIN for one
table, but in this case, we have two tables (the 'subs') being linked
to one (main).

Any help would GREATLY be appreciated!
 
use a UNION
SELECT * FROM

(
SELECT SubID, ID, Title FROM tblSub1

UNION

SELECT SubID, ID, Title FROM tblSub1
) A

ORDER BY A.ID

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top