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 2005 Forums
 Transact-SQL (2005)
 Help On SQL Query....

Author  Topic 

tytyguy
Starting Member

13 Posts

Posted - 2008-05-13 : 06:41:42
Hello, I hope this is the right forum to post this. I have a database for my car parts store. The tables I have are Product, Manufacturer, ProductManufacturer, Category, and ProductCategory. How can I get all Product Manufacturers that are in a category? I hope that makes sense.

http://www.tunerplaza.com

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-13 : 06:43:59
We have to see the table definitions to make any assumption.
The general idea is however to use JOIN.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

tytyguy
Starting Member

13 Posts

Posted - 2008-05-13 : 11:42:35
I am on sql server Management STudio express. Is there a way to get table defintions?

http://www.tunerplaza.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-13 : 11:47:13
quote:
Originally posted by tytyguy

I am on sql server Management STudio express. Is there a way to get table defintions?

http://www.tunerplaza.com


sp_help YourTableName
Go to Top of Page

tytyguy
Starting Member

13 Posts

Posted - 2008-05-13 : 12:03:26
How do I export it to paste values here?

http://www.tunerplaza.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-13 : 12:22:21
quote:
Originally posted by tytyguy

How do I export it to paste values here?

http://www.tunerplaza.com


copy and paste it with code tag
Go to Top of Page

tytyguy
Starting Member

13 Posts

Posted - 2008-05-13 : 13:15:25
Got it...
SELECT     dbo.Manufacturer.ManufacturerID, dbo.Manufacturer.Name
FROM dbo.Product INNER JOIN
dbo.ProductManufacturer ON dbo.Product.ProductID = dbo.ProductManufacturer.ProductID INNER JOIN
dbo.ProductCategory ON dbo.Product.ProductID = dbo.ProductCategory.ProductID INNER JOIN
dbo.Category ON dbo.ProductCategory.CategoryID = dbo.Category.CategoryID INNER JOIN
dbo.Manufacturer ON dbo.ProductManufacturer.ManufacturerID = dbo.Manufacturer.ManufacturerID
WHERE dbo.Category.CategoryID = @CatID
Go to Top of Page
   

- Advertisement -