Thursday, November 21, 2013

[SQL][done] Left Join tables with no null records

My case is when I select the rows and left join the tables ,
I get many null record that I don't need.
SELECT o.name, o.thumb, c.name, c.en
FROM db_options AS o
LEFT JOIN db_colors AS c
ON o.thumb = c.name 
I get total 201 records by the sql above:


Finally found need select the record with no null value:

SELECT o.name, o.thumb ,c.name, c.code, c.zh
FROM db_options AS o
LEFT JOIN db_colors AS c
ON o.thumb = c.name
WHERE c.name IS NOT NULL



Ended

No comments :

Post a Comment