I’m pants at MySQL, so I really need some help with this, please:
I have a table like:
Pizza Votes
------------------------
Margherita 1
Pepperoni 7
Sloppy Giuseppe 3
And an other table like:
ID Pizza Recipe Votes
-------------------------------------------------------------
1 Margherita Jamie Oliver 1
2 Pepperoni Hugh Fearnley Whittingstall 7
3 Sloppy Giuseppe Gino D'Acampo 3
4 Margherita Jamie Oliver 1
5 Pepperoni Jamie Oliver 7
6 Sloppy Giuseppe Jamie Oliver 3
7 Sloppy Giuseppe Hugh Fearnley Whittingstall 3
Notice in the first table, the Pepperoni pizza has the most votes, so I’d like to get the rows from the second table WHERE the Pizza column contains “Pepperoni”.
In pseudo-code: SELECT * FROM the second table WHERE the Pizza column = the pizza from the first table with the most votes
So far I have this: 'SELECT * FROM pp_pizzas INNER JOIN pp_recipes ON pp_pizzas.pizza = pp_recipes.pizza'
I really don’t understand all this MySQL stuff so if I could ask for an explanation as well as a pointer/answer I’d be very grateful, just so I can learn for next time!
Thank you all so much!
You could try:
You could also try: