Linq をエンティティに使用する count コマンドに関して問題があります。私がやりたいことは、すべての性別を私の従業員の市民ステータスで数えることです。
市民のステータス 0 - all ; 1 = single ; 2 - married
私はエンティティへのlinqの初心者です。ここにSQLコマンドの私のコードがあります。
これをどのように変換するのかわかりません。
select '0' as UserID, COUNT(a.Gender) as TotalCount from Employees a
union all
select '1' as UserID, COUNT(a.Gender) as TotalCount from Employees a where a.CivilStatus = 1
union all
select '2' as UserID, COUNT(a.Gender) as TotalCount from Employees a where a.CivilStatus = 2
このような
UserID | TotalCount
0 | 10
1 | 7
2 | 3
ヒント
10 人の従業員 (男性と女性) がいるとしましょう。そのうちの何人が独身か既婚かを知りたいです。
ありがとう。=)