vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| André Hänsel <andre@webkr.de> wrote in <1186627664.860237.165850@w3g2000hsg.googlegroups. com>: > since MAX() is an aggregate function, is there a "normal" > MAX() that works like this: > > SELECT MAX(1,2); > -> 2 mysql> SET @a=1; Query OK, 0 rows affected (0.06 sec) mysql> SET @b=2; Query OK, 0 rows affected (0.00 sec) mysql> SELECT IF(@a>@b,@a,@b); +-----------------+ | IF(@a>@b,@a,@b) | +-----------------+ | 2 | +-----------------+ 1 row in set (0.04 sec) mysql> SELECT IF(@b>@a,@b,@a); +-----------------+ | IF(@b>@a,@b,@a) | +-----------------+ | 2 | +-----------------+ 1 row in set (0.00 sec) Beware of NULLs. -- ....the pleasure of obedience is pretty thin compared with the pleasure of hearing a rotten tomato hit someone in the rear end. -- Garrison Keillor |