hey everyone, sorry if this has been answered before, couldnt find anything .Here we go:there are two tables:create table songs(song_name text, song_artist text,song_url text, song_cat text, last_edit text);create table categories(cat_name text, cat_total int);
im trying to create a trigger that, when i insert a new song in the songs table, it will check the category of the song (song_cat) and increase the respective cat_total (from table categories) by 1.here is what i've done so far:drop trigger countcat;CREATE TRIGGER countcat AFTER INSERT ON songs FOR EACH ROWupdate categories SET cat_total= cat_total +1WHERE cat_name = (select song_cat FROM inserted);
the truth is that i have no idea what to write in the cat_name = (select ...). I have tried lots of stuff but still nothing.when i use this, i get the error that mydatabase.inserted doesnt exist