I'm not sure if this is possible but is there a way to select A unless its null then select B instead?
I am writing a trigger, my code is
insert into tbl_a(userid, obj)
select p.author, new.id
FROM user_comment AS p
WHERE p.id=new.parent
however new.parent
is a nullable long (i'll switch to foreign key once supported in system.data.sqlite)
if its null i get 0 results and no insert. I would like to use join media as m on m.id=new.media_id
and return m.user_id
if new.parent
is null. So how do i write the select to return m.author
if parent isnt null (which i'll return p.author
like the above)