Ciao a tutti,
domanda semplice... utilizzando CASE con MySQL, quando si verifica una condizione, posso lanciare un update?
Es:
codice:select case campo when 1 then (update tabella set campo = 2) end from tabella
Ciao a tutti,
domanda semplice... utilizzando CASE con MySQL, quando si verifica una condizione, posso lanciare un update?
Es:
codice:select case campo when 1 then (update tabella set campo = 2) end from tabella
Intendi una cosa del genere?
codice:update tabella set campo = ( case when campo = 1 then 2 when campo = 2 then 3 else 4 /*edit. oppure else campo per lasciare invariati i valori negli altri casi */ end)
grazie mille, funziona!!