PHP SQL Query: how to select same Ids?
515
My code is:
$vote = DB::SELECT(DB::RAW("SELECT * FROM votes WHERE product_id = product_id; "));
Here[1] is a screenshot of my DB.
I'd like to ask how to select the same Producut Id in the SQL Query?
Answer
Solution:
If you want to count sum of votes for each product and sort sum of votes from highest to lowest, then your query is: