SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Joined SQL Query for 3 tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

teamjai
Starting Member

India
44 Posts

Posted - 08/25/2014 :  02:43:22  Show Profile  Reply with Quote
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

USA
333 Posts

Posted - 08/25/2014 :  14:50:18  Show Profile  Reply with Quote
select Seg.* 
from Segementation Seg 
INNER JOIN SegmentBrelationship SBR ON Seg.ID = SBR.SegID
INNER JOIN Btype BT ON BT.ID = SBR.BTID


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

djj
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000