Query for multiple joins

Posted by Shailaja on Stack Overflow See other posts from Stack Overflow or by Shailaja
Published on 2012-10-19T10:49:37Z Indexed on 2012/10/19 11:01 UTC
Read the original article Hit count: 176

Filed under:

i have 3 tables named dataset,dataelem and transformdataelem with column names as below:

main.Dataset 
------------
datasetID (PK)
applicationID

main.Dataelem
------------- 
dataelemID(PK)
datasetID(FK)
dataelemname
biztermID

main.Transformdataelem
----------------------
OutputdataelemID
InputdataelemID

My requirement is:

All tables are referenced.

Extract all the dataelemId rows from dataelem table where applicationID of dataset table is equal to 1044 and biztermid shud be null.

Then whatever resultant dataelemIDs from the above query should be matched with outputdataelemID of Transformdataelem table and we shud get the respective input dataelemId's.

Again with these matched inputdataelemID's we shud get the dataelemname's from datelem table.

© Stack Overflow or respective owner

Related posts about sql-server