I have a table with feed for our system
it's look like this:
id | owner_id | user_id | feed_type_id | object_id | created_at | updated_at
feed_type_id - represent type of object that is stored in different table (article or job_post)
object_id is the object ID itself, but I don't have a clue if this object is still active. So I have get all active id for different type of object, but when I am trying to build query with IF statement something like this
SELECT * FROM feeds WHERE "owner_id" in (2, 4, 1356) AND object_id IN ( IF `feed_type_id` = 1 THEN (2,3,23,33) ELSE (4,5,77,33) end if)
it's not working.
Can someone give me an idea how to do this?
Aucun commentaire:
Enregistrer un commentaire