In my DB I have the products table (ID int, … , Sponsored bool)
My goal is to be able to get 20 random products from the table. Sponsored products must be returned first. If there are less than 20 sponsored products I sould get random non sponsored products till 20 items.
Can I do this in one select? Or if not one select as efficient as possible.
1 Answer