I'm trying to get into databases and have a sample database with tables regarding tables. I want to write out all departures that are occuring in the database and write how many of them are happening.
SELECT l.location
FROM locations l
WHERE EXISTS
(SELECT d.departureLocCode
FROM trip_directory d
WHERE l.LocationCode = d.departureLocCode);
This is what I have now and it writes out the depratures I need.
However, when I try using count(location) in this example I only get the first location printed out with the number of times departures occur instead of how many times each one of them occured.
Any suggestions?
question from:
https://stackoverflow.com/questions/65944825/mysql-counting-how-many-times-a-value-is-called 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…