IIF SQL 2002

  • Thread starter Thread starter Ed Wiancko
  • Start date Start date
E

Ed Wiancko

Hello,

I'm trying to us IIF in a SQL Query in Access 2002. This
worked great in other versions:

SELECT iif([Month Number]=4,[answered]+[unanswered],0) AS
[Month 4] FROM [Call Counts];

Any ideas?

Thanks,
Ed
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is this an .adp file? Is it connected to a MS SQL Server?

IIf() only works in a JET db (Access db). In MS SQL Servers you'd use
the T-SQL CASE statement. E.g.:

SELECT
CASE WHEN [Month Number]=4
THEN [answered]+[unanswered]
ELSE 0
END AS [Month 4]
FROM [Call Counts]

Other db engines have CASE statements - check their documentation.


MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQDt+1YechKqOuFEgEQIiuQCgugrQQPkPX72DkKGUHqOb1F8FUIUAoN/j
Xdt/3wqmUTMChQxgMsVLS3ij
=NUo4
-----END PGP SIGNATURE-----
 
Back
Top