I am trying to select random post ID's from multiple tables but assuming the user has not already viewed the post before. I have gathered all the post ID's the user has view in an array and I was hoping to use that to rule out a random post.
My thinking has brought me to a query like this but it's obviously wrong because the ID is being used twice.
(SELECT id FROM table1)
UNION (SELECT id FROM table2)
WHERE id != 423812240250
ORDER BY rand()
LIMIT 1