所以我有3個表:選擇即使數= 0的MySQL
accident, involve and car.
Car (registration_nr, model,year)
involve (licence_nr,registration_nr (FK of car), raport_nr (FK of accident))
accident(raport_nr, date)
我都數不過來的事故從一月1,2014每個車型的數量,而且還必須選擇汽車行駛數0(從01年1月1日起沒有發生事故)這對我來說是困難的部分,直到現在我只能選擇那些在事故中遇難的人。
Select c.model,count(m.registration_nr)
from car as c
join involve as i
on i.registration_nr=c.registration_nr
join accident as a
on i.raport_nr=a.raporti_nr
where a._date between '2014-01-01' and curdate()
group by c.model;
那麼,什麼是「M」? – Strawberry