mysql where sum > 0 1

mysql where sum > 0

 SELECT, CONCAT(lastname, firstname), year, month, date FROM user
LEFT JOIN adoption ON = adoption.adopter
HAVING SUM(CONCAT(year,month,date) = '2016618') = 0

Here is what the above code is Doing:
1. Selecting the, lastname, firstname, year, month, date from the user table
2. Joining the adoption table to the user table on the adopter column
3. Grouping the results by
4. Having the sum of the concatenated year, month, date equal to 2016618

The above code will return all users who have not adopted a dog on June 18, 2016.

Similar Posts