Tuesday 15 February 2011

php - Query doesn't fetch all results -



php - Query doesn't fetch all results -

i have bit of problem query made, doesn't fetch results there are. should @ to the lowest degree come 3 rows comes one:

select * n_news article_id in (select distinct article_id nk_article_category category_id in (2,10,11,12)) order article_featured desc,article_published desc

anybody thought i'm doing wrong? mysql didn't find errors. in advance left article_id , right = category_id in table nk_article_category. there 1 result way didn't see point show whole table

what see per posted query info image, query returning right result. rows distinct (it considered duplicate if both article_id , category_id same in multiple rows).

btw, can alter posted query inner join instead of using sub query like

select t1.* n_news t1 inner bring together nk_article_category t2 on t1.article_id = t2.article_id , t2.category_id in (2,10,11,12) order t1.article_featured desc, t1.article_published desc;

php mysql sql

No comments:

Post a Comment