MySQL Forums
Forum List  »  PHP

Re: Basic Join query does not work
Posted by: Peter Brawley
Date: June 26, 2021 10:24AM

You can use backticks (`) around table & column names (so that illegal character names in such names are accepted), but not quotes. Read about table & column names in the manual page on SELECT expressions.

To improve query readability and maintainability, use aliases for table names. Read about aliases in the manual.

You want the row count, or the vote count for a user? If its to be the vote count ...

SELECT SUM(r.vote)
FROM recommendations r
JOIN products p ON r.product=p.id
WHERE p.author=':username' ;



Edited 1 time(s). Last edit at 06/26/2021 10:25AM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
Re: Basic Join query does not work
June 26, 2021 10:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.