NYCPHP Meetup

NYPHP.org

[nycphp-talk] SQL COUNT() Question

Adam Maccabee Trachtenberg adam at trachtenberg.com
Sat Feb 14 00:37:43 EST 2004


On Fri, 13 Feb 2004, putamare wrote:

> SELECT
> SUM( IF ( win = $team, 1, 0 ) )  AS w,
> SUM( IF ( loss = $team, 1, 0 ) )  AS l
> FROM games

Thanks. Turns out IF() is a MySQL specific function (or it's not part
of SQLite at least), but it only took one line to emulate it as a
UDF. :)

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!



More information about the talk mailing list