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

If then

Status
Not open for further replies.

pungigi

Programmer
Oct 29, 2003
115
US
Can I do some kind of if then in a query???

What I am doing is

Trip Status = S1, SQ or SR
Trip Type countif R then 2 else 1

What I need is to be able to get information based on above TWO criterias.

 
Take a look at the SQL In operator and at the IIf function:
WHERE [Trip Status] In ('S1', 'SQ', 'SR')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
use CASE statement...

Something like this...

CASE
WHEN Trip Type= 'R' THEN blahblah=2
Else
blahblah=1
END

-L
 
Lothario, CASE is OK for passthru query to an Ansi SQL compliant RDBMS, not for regular JetSQL.
The Access way is IIf.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV...

I thought i was replying in the SQL Server programming forum...

-L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top