Created
October 27, 2015 04:38
-
-
Save bigfoot90/da3bd91fafb7b55a35c7 to your computer and use it in GitHub Desktop.
Returns the number of 'Audi', 'BMW' and 'Mercedes' cars grouped by year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| q.year, | |
| (SELECT COUNT(q1) FROM AppBundle\Entity\CarPark q1 WHERE q1 = q AND q1.producer = "Audi") AS Audi | |
| (SELECT COUNT(q1) FROM AppBundle\Entity\CarPark q1 WHERE q1 = q AND q1.producer = "BMW") AS BMW | |
| (SELECT COUNT(q1) FROM AppBundle\Entity\CarPark q1 WHERE q1 = q AND q1.producer = "Mercedes") AS Mercedes | |
| FROM AppBundle\Entity\CarPark q | |
| GROUP BY q.year | |
| ORDER BY q.year ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment