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

Case statement with Multiple Parameters

Status
Not open for further replies.

gkrenton

MIS
Jul 2, 2003
151
0
0
US
So trying to do an if statement that's only executed if the 2 things are true.

I have

select
distinct E.inv_id,
E.inv_id||03,
CASE when EC.inv_color like "NO%" AND EC.web_show = 1 then 0 else 9 END
from ecat_items as E inner join ecat_item_color as EC ON E.inv_id=EC.inv_id
where E.web_show=1

But this fails so I'm wondering if I can do a multiple case statement like this.

As always thanks in advance.

-Gina





 
Gina:

Are you sure your select is working without the case statement? I ran this select which contains a case statement similar to yours and it works:

select *,
CASE WHEN A.version LIKE "97%" AND A.installed = "N" THEN 0 ELSE 9 END
from db_revision A

 
Thanks - actually it does work if one calls the fields correctly. Took re-writing it & reviewing to realize it but yes it does work. Thank goodness.

gina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top