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)
 Expression never

Author  Topic 

SGB19
Starting Member

10 Posts

Posted - 2007-03-05 : 11:31:41
Any comment is appreciated and welcome.



Here is the table structure for CUSTOMER:
CustomerID Name StreetAddress
State
ZipCode
----------- ----------------------------------------------

Here is the table structure for INVOICE:
InvoiceNbr InvoiceDt
TotalPrice
CustomerID
EmpID


Here is the table structure for INV_LINE_ITEM
LineNbr
Quantity
InvoiceNbr
PartNbr
StoveNbr
ExtendedPrice


Here is the table structure for stove:
SerialNumber Type
Version DateOfManufacture
Color
EmpId


I need to find all the stoves that were never been bought by these customers. I wrote these queries but the projection was wrong.

SELECT type+version as 'Stove type/version never purchased by PA customers'
from STOVE
WHERE SERIALNUMBER IN
(SELECT STOVENBR
FROM INV_LINE_ITEM
WHERE INVOICENBR IN
(SELECT INVOICENBR
FROM INVOICE
WHERE CUSTOMERID IN
(SELECT CUSTOMERID
FROM CUSTOMER
WHERE STATEPROVINCE = 'pa')));

I tried these queries but I did not get the results expected. Any comment is welcome.

Thanks

sgb19



********
***sg***
********

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-03-05 : 17:55:26
Duplicate http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79961
Go to Top of Page
   

- Advertisement -