mysql:15630
From: mule moscow <mule moscow <moscowmule1115@xxxxxxxxxx>>
Date: Tue, 20 Sep 2011 11:44:09 +0900
Subject: [mysql 15630] Re: [mysql 15628] LEFT JOIN で結合先がない場合
WHERE を AND にすると期待している結果が得られると思います。 久光 一誠 <ds1i-hsmt@xxxxxxxxxx>: $B5W8w$H?=$7$^$9(B $B2<5-$N$h$&$J#3$D$N%F!<%V%k$,$"$j!"(B $B>&IJ%F!<%V%k(B(tabS) [id] [name] 1 $B%F%l%S(B 2 $B@vBu5!(B $B9q%F!<%V%k(B(tabK) [id] [name] 1 $BF|K\(B 2 $BJF9q(B 3 $BCf9q(B $B9qJL>pJs%F!<%V%k(B(tabJ) [shouhin_id] [kuni_id] [jouhou] 1 1 $B>pJs(BA 1 3 $B>pJs(BB 2 2 $B>pJs(BC $B$3$N%F!<%V%k9=@.$+$iNc$($P%F%l%S$K4X$9$k9qJL>pJs$r9q%F!<%V%k$N(Bid$B=g$K(B $B!!>pJs(BA $B!!!J6uCM$^$?$O(BNULL$B!K(B $B!!>pJs(BB $B$H$$$&7A$G<h$j=P$=$&$H;W$$(B SELECT tabJ.jouhou FROM tabK LEFT JOIN tabJ ON tabK.id = tabJ.kuni_id WHERE shouhin_id = 1 ORDER BY tabK.id $B$H=q$$$?$N$G$9$,!"$3$l$G$O7k9g@h$,$J$$$b$N$O6uCM$^$?$O(BNULL$B$GJV$C$F$3$:!"4|BT$7$?7k2L$K$J$j$^$;$s$G$7$?!J>pJs(BA$B$H>pJs(BB$B$N#29T$7$+JV$C$F$3$J$+$C$?!K!#(B $B>e5-$N%F!<%V%k9=@.$G!"9q%F!<%V%k$N(Bid$B=g$K1h$C$F9qJL>pJs%F!<%V%k$+$i!J>pJs$,$J$$>l9g$O6uCM$^$?$O(BNULL$B$,JV$C$F$/$k$h$&$K!K<h$j=P$9$K$O$I$s$J(BSQL$BJ8$r=q$$$?$i$$$$$G$7$g$&$+!)(B $B$J$*9qJL>pJs%F!<%V%k$O>&IJ(BID$B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