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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limitation of OR operator 1

Status
Not open for further replies.

Maii

Programmer
Aug 28, 2003
54
BD
I have build SQL query using OR operator
Such as
SELECT COMPNAYNAME FROM CUSTOMERS WHERE (CUSTOMERID =
‘AAAAA’)
OR (CUSTOMERID = ‘BBBBB’).............
It has been fail when I add more then 180 OR operators.
Are there any limitation and alternate solutions?

Thanks in advance
maii
 
Code:
SELECT COMPNAYNAME
FROM CUSTOMERS
WHERE CUSTOMERID IN
(‘AAAAA’,‘BBBBB’,'CCCCC'........)

Even better the IN can be used with a select from another table:
Code:
SELECT COMPNAYNAME
FROM CUSTOMERS
WHERE CUSTOMERID IN
(SELECT CUSTOMERID FROM ANOTHER_CUST_TABLE)

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
... especially with 180+ customers to check.

Simple question - simple and efficient answer.

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
Cheers Vongrunt

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top