https://blog.csdn.net/chenaini119/article/details/51917263
還有XML文件 不能用> <來表達大於小於 。。 例如 grade>0 , grade<10
https://blog.csdn.net/zheng0518/article/details/10449549
老周一直遇到的bug
今天遇到的一個數據查詢 的難題
就是統計 評價當前電影 各星星等級 的人數
問題:搜mysql 同一字段 相同的值 的條數
找到解決辦法的博客:https://blog.csdn.net/eaphyy/article/details/71305422
我最后寫出的語句是這樣的:
select m.id,m.name,COALESCE(startb.one,0) as onestar,COALESCE(startb.two,0) as twostar,COALESCE(startb.three,0) as threestar,COALESCE(startb.four,0) as fourstar,COALESCE(startb.five,0) as fivestar from movie m LEFT JOIN (SELECT id,star,movie_id,sum(case star when 1 then 1 else 0 end) as one, sum(case star when 2 then 1 else 0 end) as two,sum(case star when 3 then 1 else 0 end) as three ,sum(case star when 4 then 1 else 0 end) as four ,
sum(case star when 5 then 1 else 0 end) as five from score where movie_id =5) as startb on startb.movie_id = m.id