mysql left join name selecting left side records?


i'm removing rare law mysql select query involving left join, i can't know presumably bargain left join wrong presumably i'm observant honestly rare behavior.



i have twin tables many-to-one relationship: each record table 1 there 0 some-more annals table 2. i wish name annals list 1 buttress depends array associated annals list 2. i know it, left join should always relapse annals left side statement.



here's exam database exhibits problem:



create database test;
use test;

create list dates (
dateid int unsigned zero auto_increment,
date date null,
unparalleled pivotal (dateid)
) type=myisam;


create list slots (
slotid int unsigned zero auto_increment,
dateid int unsigned null,
unparalleled pivotal (slotid)
) type=myisam;

insert dates (date) values ('2008-10-12'),('2008-10-13'),('2008-10-14');
insert slots (dateid) values (3);


the dates list 3 records, slots 1 - record points third record dates.



if i following query..



select d.date, count(s.slotid) dates d left join slots s s.dateid=d.dateid organisation s.dateid;


..i design list 3 rows - twin count 0, count 1. nonetheless i indeed this:



+------------+-----------------+
| date | count(s.slotid) |
+------------+-----------------+
| 2008-10-12 | 0 |
| 2008-10-14 | 1 |
+------------+-----------------+


the initial record 0 count appears, nonetheless after record 0 count ignored.



am i doing something wrong, i only know left join ostensible do?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members