if в MySQL

11 Февраля 2010


Оказывается, в MySQL есть оператор if, что очень даже замечательно.

 

Ситнаксис if(условие, если_правда, если_ложь) - логика схожа с формулой Excel-я.

Все поля обязательные. Лично мне, очень пригодилось в одном отчете, когда было необходимо разделить значение одного поля на положительные и отрицательные значения в одном запрое:

SELECT if(v<0, v, '') AS v1, if(v>=0, v, '') AS v2 FROM t;

 

Отзывы

This info is the cat's pjmaaas!
Chelsi ответить

Gee whiz, and I tohught this would be hard to find out.
Servena ответить

Full of salient points. Don't stop believing or wriintg!
Constance ответить

Action requires knowlgede, and now I can act!
Latoya ответить

J1Mo3D , [url=http://ujdkqxpntrsl.com/]ujdkqxpntrsl[/url], [link=http://gludldbfdpnz.com/]gludldbfdpnz[/link], http://xs
suypxl ответить

It's good to see smoenoe thinking it through.
Kevrell ответить

That's more than snesilbe! That's a great post!
Kailey ответить

I was looking everywhere and this popepd up like nothing!
Egypt ответить

Pin my tail and call me a dnokey, that really helped.
Stone ответить

Last one to utilzie this is a rotten egg!
Nikki ответить

When you think about it, that's got to be the right asnwer.
Geraldine ответить

Didn't know the forum rules aollwed such brilliant posts.
Kenelm ответить

Alaakzaam-information found, problem solved, thanks!
Nodin ответить

I told my grandmother how you hlpeed. She said, "bake them a cake!"
Nyvaeh ответить

P9Bo2i <a href="http://ogrgbdgqmmoi.com/">ogrgbdgqmmoi</a>
yovuaalbpft ответить

tA5XTb , [url=http://ngncoxmmfuag.com/]ngncoxmmfuag[/url], [link=http://znrtemgqchft.com/]znrtemgqchft[/link], http://zf
mcshnviko ответить



Написать отзыв



Не более 2000 символов

осталось 2000 символов. Отправить

Реклама