Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select query pointing to 5 master tables depending

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2005-11-14 : 11:35:29
Based on moduletypes table info it has to make a join to the master table to get the title columns data.

Tasks table: 5 records example.

id moduleid moduletype taskdesc duedate

1 23 tablecn mytask1 113005
2 14 tableRF mytask2 123005
3 07 tableSub mytask3 113005
4 18 tableRM mytask4 113005
5 09 tableIS mytask5 113005

Above table tasks is the child table(common table) for various modules, now i want to get the titles column info of all the parent tables(tablecn, tablerf, tablesub, tablerm, tableis)
tasks table has the join info. moduleid and moduletype(which holds table name) to get the title info.

But i am confused how to write one single select to get all the various module tables title column data and show in one single resultset.

Please can you help me with the select query.

select a.id, a.duedate, b.title from tasks a, moduletype b

Thank you very much for the information.
   

- Advertisement -