0
私は既に動作しているクエリに加えて、各カテゴリに1つの余分な列を追加したいと思っています。 。誰でも助けてくれますか?あなたが派生テーブルとして、クロス総数のための既存のクエリに参加SQLクエリ:パーセンテージの追加
select
count(case when Lunchstatus = 'P' then 1 else null end) as Paid
, count(case when LunchStatus = 'R' then 1 else null end) as Reduced
, count(case when LunchStatus = 'F' then 1 else null end) as Free
, count(case when LunchStatus = 'fdc' then 1 else null end) as CertifiedFree
, count(case when LunchStatus = 'P' then 1
when LunchStatus = 'fdc' then 1
when LunchStatus = 'R' then 1
when LunchStatus = 'F' then 1
else null
end) as Total
from students
where enroll_status = 0
and schoolid = %param1%
余分な列を自由にカテゴリごとに、縮小、あなたがachiveしたいものを支払いました..より多くのデータを追加しようとする –
あなたが得る出力を表示し、あなたが望む出力を表示します – RiggsFolly