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.
| Author |
Topic |
|
Clay101
Starting Member
5 Posts |
Posted - 2008-07-14 : 15:50:54
|
| I have 2 tables; Vendor_Mast and Inventory_mastMy query is to try to find out all the items that Vendor X sells. I am very new to SQL and have no idea how to go about getting the set result. Can anyone assist with this one, please.Thank you |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-07-14 : 15:52:19
|
| You haven't provide enough information for us to give an exact answer, so all we can really say is to use a join between the two tables.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
Clay101
Starting Member
5 Posts |
Posted - 2008-07-14 : 15:58:36
|
| Thank you for the reply.In Table Inventory_Mast the Primary key is: item_num no FK are in useIn table Vendor_Master Primary Key is: vendor_num again no FK in use.Is there a way in SQL Server 2005 to get the information I am looking for without using a Foreign Key?Do you have a code example or were to find such an example of how to do this?Thank you, |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-07-14 : 16:01:36
|
| You do not need a foreign key in order to join tables together, however you should use foreign keys to protect your data. So using your two tables, how are they related? If no columns relate to each other, then you can not join them together.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-15 : 03:12:32
|
| SELECT *FROM Inventory_Mast iINNER JOIn Vendor_mast vON v.VendorID=i.VendorIDassuming you've VendorID in inventory table.Else use linking column you've |
 |
|
|
|
|
|