I am running a correlated subquery to find out the listing of vendors (by Vendor Name) that are in different cities, states, i.e. we want to know the vendors that do not have a common city and state with other vendors. It seemed like a self-join was the thing to do.
Only hints if possible, please.
The Vendors table is:
Vendors(VendorID P, VendorCity, VendorState, VendorName,...)
This is what I have:
Select VendorName, VendorCity, VendorState from Vendors AS V1 where VendorCity, VendorState NOT IN (Select VendorCity, VendorState FROM Vendors AS V2 where V2.VendorID <> V1.VendorID)
This is the error message I get:
Msg 4145, Level 15, State 1, Line 2 An expression of non-boolean type specified in a context where a condition is expected, near ','.
I don't see why there is a reference to Boolean types, since this is not an EXISTS or other related query.