mysql group by show count 0 not sure if I can left join here -


i have query , want return row when count 0

select count(day) count, day `table` group `day` 

other stackoverflow answers need left join.
don't know how in scenario.

create table thedays (   aday varchar(20) not null );  create table sales (   id int auto_increment primary key,     aday varchar(20) not null,     prodid int not null,     qty int not null );  insert thedays values ('sunday'),('monday'),('tuesday'),('wednesday'),('thursday'),('friday'),('saturday'); insert sales(aday,prodid,qty) values ('tuesday',101,4),('thursday',107,2);  select d.aday thedays d left outer join sales s on d.aday=s.aday s.aday null  +-----------+ | aday      | +-----------+ | sunday    | | monday    | | wednesday | | friday    | | saturday  | +-----------+ 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -