unknwn Posted September 22, 2013 Report Share Posted September 22, 2013 (edited) . Edited November 10, 2024 by unknwn Quote . Link to comment Share on other sites More sharing options...
f4ts0 Posted September 22, 2013 Report Share Posted September 22, 2013 za pocetak stavi kriterijum na 174, otherwise, saftaj ga :) Quote You may have gone to Cambridge, but I'm an honorary graduate of Starfleet Academy Link to comment Share on other sites More sharing options...
primo Posted September 22, 2013 Report Share Posted September 22, 2013 (edited) Ne znam mysql sintaksu tacno, al evo ti sql pa ti vidi sam kako ces napraviti procedure UPDATE covek SET kategorija='nizak' WHERE visina < 175 UPDATE covek SET kategorija='visok' WHERE visina > 175 ... ili nisam nikad koristio CASE ali trebalo bi ovako da izgleda nekako: UPDATE covek SET kategorija= ( CASE WHEN (visina < 175) THEN 'nizak' WHEN (visina > 175) THEN 'visok' WHEN (visina < 150) THEN 'midget_lol' END ) druga: DELETE FROM covek WHERE kategorija='midget_lol' Edited September 22, 2013 by primo Quote Link to comment Share on other sites More sharing options...
primo Posted September 22, 2013 Report Share Posted September 22, 2013 ispitujes lokalnu promenjivu visina umesto polja u tabeli? Quote Link to comment Share on other sites More sharing options...
primo Posted September 22, 2013 Report Share Posted September 22, 2013 (edited) Mislim da ne, vec da je to samo obicna lokalna promenjiva. CREATE DEFINER=`root`@`localhost` PROCEDURE `MidgetProcedura`( in iime varchar(50), BEGIN UPDATE covek SET kategorija= ( CASE WHEN (visina < 175) THEN 'nizak' WHEN (visina > 175) THEN 'visok' WHEN (visina < 150) THEN 'midget_lol' END //ili END CASE ) WHERE ime=iime; END Ovako bi trebalo da izgleda sa nekim parametrom, ali koliko sam shvatio tebi treba nakom X inserta podataka da pokrenes neku proceduru koja ce postaviti polje kategorija na odgovarajucu vrednost? (u tom slucaju ti ne treba ovo WHERE) Zasto ne koristis triggere? Edited September 22, 2013 by primo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.