samedi 25 novembre 2017

if statement in sqlite

i want to do something like this in sqlite:

commit;
begin transaction;
insert into payment (`value`)
values(12);
update product_collected set payment_id=(select id from payment  order by id
desc limit 1)
where payment_id is null or payment_id = 0;
if(changes()>0)
    commit transaction; 

when i execute the query, it says:

near "if": syntax error: if.

what should i do?

there is a relation between payment and product_collected tables.

Aucun commentaire:

Enregistrer un commentaire