0
SELECT ac1.id, ac1.course_name, case when a.yettoapprove is not null
then 'true'
else 'false'
end OrderedAll , a.* from (SELECT ac.id, sum(case when ad.status = '2' then 1 else 0 end) as yettoapprove , sum(case when ad.status = '1' then 1 else 0 end) as approved,case when ad.status = '2' is not null
then 'true'
else 'false'
end OrderedAll FROM aw_ou_student_data ad , jos_users ju , aw_ou_lookup_courses ac,aw_ou_lookup_colleges ac1 where ac1.id=ju.college_code and ac.id in (27,28,29,30,133,32,33,34,35,36,37,38,39,40,41,42,43,44,134,135) and ac.school_id=2 and ju.id=ad.user_id and ac.id=ju.course_code GROUP BY ac.id ORDER BY ac.id) a left join aw_ou_lookup_courses ac1 on ac1.id = a.id
在上面的內部查詢中,我已經給出了20 ac.id
但我只有14條記錄作爲結果。我如何獲得總共20條記錄。即身份證目前在條件,如果它不滿足,那麼我應該記錄與0作爲值旁邊的身份證。在conditon相關的查詢中的Mysql
我該怎麼做..?
我沒有在上面的查詢同樣的事情,但它仍然是不來了。我在哪裏出錯在上面的查詢.. – sandy