如何使用Haskell中的Esqueleto实现MySQL的group_concat?
我需要找出如何在Haskell中的Esqueleto下实现MySQL的group_concat。 Esqueleto功能应看起来像以下内容,但此版本适用于SQLite。因此,我需要MySQL的工作解决方案:
sqliteGroupConcat ::
PersistField a
=> SqlExpr (Value a)
-> SqlExpr (Value a)
-> SqlExpr (Value Text)
-- sqliteGroupConcat (t ^. BookmarkTagTag) (val " ")
sqliteGroupConcat expr sep = unsafeSqlFunction "GROUP_CONCAT" [expr, sep]
由于MySQL版本中的输入未分开,因此我无法使用此group_concat函数。 MySQL的Group_Concat函数应该能够执行以下SQL函数:
GROUP_CONCAT(country SEPARATOR ';')
I need to find out how to implement MySql's Group_Concat under Esqueleto in Haskell. The esqueleto function should look like the following but this version is suitable for Sqlite. So I need a working solution for Mysql:
sqliteGroupConcat ::
PersistField a
=> SqlExpr (Value a)
-> SqlExpr (Value a)
-> SqlExpr (Value Text)
-- sqliteGroupConcat (t ^. BookmarkTagTag) (val " ")
sqliteGroupConcat expr sep = unsafeSqlFunction "GROUP_CONCAT" [expr, sep]
I cannot use this group_concat function for mysql as the inputs in mysql's version aren't comma separated. The group_concat function for mysql should be able to perform the following sql function:
GROUP_CONCAT(country SEPARATOR ';')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论