I have a table with profiles holding information on accounts on my site. It's possible to promote a profile on different pages ex. search page and frontpage until an expire date.
Promotions is stored in the table profile_promo and joined by profile_id.
My problem is that on the search page I want to show all profiles and left join with the promotion table
LEFT JOIN profile_promotion pp ON pp.profile_id = profile.id
WHERE (pp.page = 'search' OR pp.page is NULL) and pp.expire >= now()
This works fine as long as there is a promotion on the search page or if there is no promotions at all.
If there is only a promotion on the frontpage I don’t get any results at all for my search page because of the WHERE.
But I still want the information from the profile regardless if there are promotions or not. Due note, that a profile can have promotion on multiple pages at the same time (maybe that changes some logic)
I’m not good at SQL so how do I solve this?