Reputation: 764
I do not know where to start with this one, not sure if it is possible.
I have multiple columns. To simplify I will minimize my actual setup since I can describe it fine with two tables
Say I have two tables called thumbs & thumb_clicks. What I need to do is select all of the most clicked thumbs and order by most clicked. My problem however is, what if only 2 thumbs were clicked and I need to display 100 on the page.
What I would like to accomplish is select thumbs by most clicked, if results are less than 100, select the most relevant thumbs to fill the rest of the spots.
I am looking to be pointed in the right direction for this if possible! Appreciate it!
Upvotes: 0
Views: 413
Reputation: 62405
What you looking for is UNION
clause that lets you 'merge' results from two (or more) queries.
http://dev.mysql.com/doc/refman/5.5/en/union.html
Upvotes: 1