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!

Translating SQL from SQLServer to Access 1

Status
Not open for further replies.

jmeadows7

IS-IT--Management
Jun 13, 2001
148
0
0
US
I want to retrieve the max value of a column or return 0 if it is NULL. I know how to write it in SQL 92 -
SELECT
CASE
WHEN max(loc_csreq_id) IS NULL THEN 0
ELSE max(loc_csreq_id)
END
FROM csreq

Anyone have a quick translation to Access for me?

Thanks!!
 
Something like:

Nz(Max(loc_csreq_id),1)
 
Thanks,

I still have to make it work with a WHERE clause, but I think I can handle that. I've never used NZ before - thanks for the tip!
 

[tt]SELECT Nz(Max(loc_csreq_id),1)
FROM tblTable
WHERE Field1='AAA' AND Field2=200 AND Field3=#12/31/2007#[/tt]
 
Remou - thanks - your tip came in before I even had a chance to get back to try it.

Worked perfectly.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top