John Wards wrote:

I have this query:

SELECT *
FROM news_category
LEFT JOIN news_x_cat ON news_category.id = news_x_cat.cat_id
WHERE (
news_x_cat.news_id = 9 OR news_x_cat.news_id IS NULL
)


Which gives me this output:

id title perm show news_id cat_id
1 About Us 1 1 NULL NULL 2 Learn About Your Hair 1 1 NULL NULL 3 Press Room 0 0 9 3 4 Research News 0 0 9 4


Its Padding out with NULLs fine for the first 2 but missing out a few other records from news_category.

What I want the query to do is display all the news_categorys if they are mentioned in news_x_cat or not and if they don't have any data with in news_x_cat I need this bit padded out with NULLs.

Any ideas where I am going wrong?

yes, you use a WHERE


if you want all, dont use this WHERE!

with your WEHRE you get only this news_category which have a news with the id 9 or no news at all

--
Sebastian Mendel

www.sebastianmendel.de
www.tekkno4u.de
www.nofetish.com


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to