Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement difficulties

Status
Not open for further replies.

andrewbadera

Programmer
Jan 27, 2002
43
US
SELECT * FROM bulbdirectSQL.dbo.tblProduct AS Product JOIN bulbdirectSQL.dbo.tblCategory AS Category ON Category.intCategoryID = Product.intProductID JOIN bulbdirectSQL.dbo.tblBase AS Base ON Base.intBaseID = Product.intBaseID JOIN bulbdirectSQL.dbo.tblVolts AS Volts ON Volts.intVoltsID = Product.intVoltsID JOIN bulbdirectSQL.dbo.tblWatts AS Watts ON Watts.intWattsID = Product.intWattsID WHERE '|1|' IN Product.strClassIDs

Gives me:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'Product'.

/rsa/bulbdirect/search.asp, line 141

And it's definitely the WHERE clause that's causing the problem.

Any thoughts?
 
>>WHERE '|1|' IN Product.strClassIDs

When using the IN predicate, you normally need to provide a list of values, like this:

WHERE '|1|' IN ('war', 'abc', '|1|', 'A41')

Also, a subquery can be used to provide the list of values:
WHERE '|1|' IN (Select strClassIDs From dbo.tblProduct)

Not sure exactly what you need here, but perhaps this will work?
WHERE Product.strClassID = '|1|'
--------------------------------

bp


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top