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 2008 Forums
 Transact-SQL (2008)
 Joined SQL Query for 3 tables

Author  Topic 

teamjai
Yak Posting Veteran

52 Posts

Posted - 2014-08-25 : 02:43:22
1)Table Name - Segementation
- ID (primary Key)
- Producttype
- Material

2) Table name- Btype
-ID (primary Key)
-Bcode

3)Table name - SegmentBrelationship
-Id (primary key)
-SegID (Foreign key) (from Table Segmentation)
-BTID (Foreign key) (from Table -Btype)
-Material

i need joined SQL query with following tables and fields would be needed for helping to cross check whether all correct materials are assigned.

My query

Select ID, ProductType,Material from segementation..

Here i need to check the BTID and Material from btype & SegmentBrelationship table..

Could you please help me. Thanks.

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2014-08-25 : 14:50:18
[code]select Seg.*
from Segementation Seg
INNER JOIN SegmentBrelationship SBR ON Seg.ID = SBR.SegID
INNER JOIN Btype BT ON BT.ID = SBR.BTID[/code]

This is not the answer but an example to help you find the answer.

djj
Go to Top of Page
   

- Advertisement -