In C++, si può fare questo:SQL: ternario operazioni
T.x = (T.y > 1 && (T.x - T.y < 0)) ? 0 : (T.x - T.y)
che a [quasi] parole povere, è
if T.y > 1 and T.x-T.y < 0 then
set T.x to 0
else
set T.x to T.x-T.y
E 'possibile fare la stessa cosa utilizzando solo SQL, senza usare proc o trigger memorizzati
vedi: http: //dev.mysql .com/doc/refman/5.0/it/case-statement.html – diEcho
Vedere http: // sta ckoverflow.com/q/1647961/584420 –