SQL modifiy query help

hi guys,

I find some query which I must modify but problem is I don’t know what all parts of already written mean.

SELECT “If status=100 - NO MO on xxx connection. Restart xxxx adapter and xxxxxxxxxxxxx” as description, IF( MO.cnt= 0 AND HOUR(NOW())>8,100,1) AS status FROM ( SELECT count(*) as cnt FROM mo_messages WHERE time_received > NOW() - INTERVAL 1 HOUR AND nwc in (28405,28401,28403) ) as MO;

this part is confusing me:
IF( MO.cnt= 0 AND HOUR(NOW())>8,100,1)

can you help me explain what this means?
I’m beginner in sql so I’m not sure what should I even look for in tutorials

Ako pomaže na hrvatskom…

IF( MO.cnt= 0 AND HOUR(NOW())>8,100,1)

IF je funkcija koja ima tri parametra. Prvi je logički izraz, u našem slučaju:
MO.cnt= 0 AND HOUR(NOW())>8

Drugi parametar je vrijednost koju IF funkcija vraća ako je logički izraz TRUE, u našem slučaju:
100

Treći parametar je vrijednost koju IF funckija vraća je logički izraz FALSE, u našem slučaju:
1

thank you for your help :slight_smile:


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey