Groups | Blog | Home
all groups > sql server new users > february 2005 >

sql server new users : SQL Query Woes - Please Help


Sue Hoegemeier
2/4/2005 9:57:29 AM
Dale,
Sample data and sample output would really help as Adam
suggested. I am having a hard time understanding what you
mean by:
[quoted text, click to view]

-Sue
Adam Machanic
2/4/2005 11:48:51 AM
Can you post DDL + sample data + sample output?

http://www.aspfaq.com/etiquette.asp?id=5006

--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--


[quoted text, click to view]

Dale Palmer
2/4/2005 1:00:00 PM
I'm having trouble trying to get a Select Statement working, my current
statement is attached below.

I have two tables: Table one (tblProducts) is product description & Table
two (tblExtraProd) is a list of ingredients for each product.

I need to be able to select and ingredient that needs to be included and one
that needs to be excluded and get a result.

Any help or ideas would be very much appreciated.

Regards

Dale

SELECT seasonedpi.dbo.tblProducts.P_ID,
seasonedpi.dbo.tblProducts.DISPLAYNAME, seasonedpi.dbo.tblProducts.Cuisine,
seasonedpi.dbo.tblProducts.PType,
seasonedpi.dbo.tblProducts.mild, seasonedpi.dbo.tblProducts.sultry,
seasonedpi.dbo.tblProducts.spicy,
seasonedpi.dbo.tblProducts.explosive,
seasonedpi.dbo.tblProducts.volcanic, seasonedpi.dbo.tblExtraProd.ExProduct
FROM seasonedpi.dbo.tblProducts RIGHT OUTER JOIN
seasonedpi.dbo.tblExtraProd ON
seasonedpi.dbo.tblProducts.P_ID = seasonedpi.dbo.tblExtraProd.ExRelate
WHERE (seasonedpi.dbo.tblExtraProd.ExProduct <> 30) AND
(seasonedpi.dbo.tblExtraProd.ExProduct = 135)

Dale Palmer
2/4/2005 5:33:46 PM
It's okay, I've managed to work it out.

I need to use sets within the query to analyse several records at once

Regards

Dale
[quoted text, click to view]

AddThis Social Bookmark Button