-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
是否可以考虑增加对 string.Join() 方法的支持 #405
Comments
在考虑,何不直接在子查询里面处理,这样可以用在更多地方。 用表达式解析处理: .ToList((a) => new
{
a.Id,
a.Name,
Tags = freeSql.Select<Tag>().Where(b => a.Id == b.MusicId)
.First(b => SqlExt.GroupConcat(b.Name).Separator(",").ToValue())
}); MySql 目前可以这样用,SqlExt.GroupConcat 已经实现了 |
其实主要在 SQL Server 中使用,目前类似的查询都还是用 SQL 来写,上面只是临时用 SQLite 写了个例子。🙂 |
sqlserver 太蛋疼,"中国,上海,深圳," 最后的逗号很难处理。 |
暂时只针对性的对 sqlserver 进行 string.Join + ToList 解析 fsql.Select<StringJoin01>().ToList(a =>
string.Join(",", fsql.Select<StringJoin01>().As("b").ToList(b => b.name))
); |
这个忘记说了,前面引用的那个文章其实用法有问题,实际应该是把逗号放在前面,然后用 stuff 函数去处理。😂 |
不知道有这个函数,前后都试过,带会看能不能把 string.Join 一统江湖 |
SELECT listagg(b."NAME",',') within group 还非要在 within group 后面加 order by,有没有其他办法解决这个? |
…配了 sqlserver/pgsql/oracle/mysql/sqlite/达梦/金仓) #405;
用了一个复杂逻辑解决的,order by 延用子查询内的 .OrderBy() 或者 order by pk 或者 order by 1 |
适配完成了,也测试了,老板验收 |
验收不敢当,这效率只能说叶老板大气。👍🏻 |
代码:
SQL 脚本:
其他数据库的实现:
The text was updated successfully, but these errors were encountered: