MySQL Forums
Forum List  »  Italian

Re: Problema con query
Posted by: Michele Abbondanza
Date: January 16, 2009 03:37AM

ciao!
il problema è che tu cerchi di usare l'if non come Control Flow, ma come statement.
la sintassi che hai usato tu la potresti usare dentro ad una stored e funzionerebbe invece dentro una select è questa la sintassi:
IF(expr1,expr2,expr3)
comunque per il tuo problema io farei così:

UPDATE tabella SET valore=valore+1 WHERE id_user = 4 AND data = CURRENT_DATE;
insert IGNORE into tabella (id_user,valore,data) VALUES ('4','1',CURRENT_DATE);

una nota, piuttosto che CURDATE() userei CURRENT_DATE :)

Options: ReplyQuote


Subject
Views
Written By
Posted
5159
January 15, 2009 11:52AM
Re: Problema con query
3375
January 16, 2009 03:37AM
3518
January 16, 2009 01:17PM
3470
January 16, 2009 05:15PM
3310
January 17, 2009 11:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.