You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT
a."Time",
v1 =sum(case when a."Id"==1 then 1 else 0 end),
v2 =sum(case when a."Id"==2 then 1 else 0 end),
v3 =sum(case when a."Id"==3 then 1 else 0 end)
FROM"table" a
WHERE a."Id"IN (1,2,3)
GROUP BY a."Time"
如上 v1,v2,v3 是动态聚合值,如果 where IN (1,2,3,4) 那就会产生 v1-v4
正常情况下,静态的 lambda 查询没办法处理这种动态列查询。
变通一下,这样查询:
SELECT
a."Time",
v =sum(case when a."Id"==1 then 1 else 0 end) +','sum(case when a."Id"==2 then 1 else 0 end) +','sum(case when a."Id"==3 then 1 else 0 end)
FROM"table" a
WHERE a."Id"IN (1,2,3)
GROUP BY a."Time"
如上 v1,v2,v3 是动态聚合值,如果 where IN (1,2,3,4) 那就会产生 v1-v4
正常情况下,静态的 lambda 查询没办法处理这种动态列查询。
变通一下,这样查询:
如此便可以使用 FreeSql 实现:
自定义解析表达式树,实现如下:
The text was updated successfully, but these errors were encountered: