gpt4 book ai didi

sql - 从字符串到 Blob

转载 作者:行者123 更新时间:2023-11-29 02:38:31 25 4
gpt4 key购买 nike

我正在尝试在 group_concat 命令中使用 concat_ws。使用查询,简化后的样子:

SELECT item.title, GROUP_CONCAT( CONCAT_WS(  ',', attachments.id, attachments.type,     attachments.name ) )  as attachments
FROM story AS item
LEFT OUTER JOIN story_attachment AS attachments ON item.id = attachments.item_id
GROUP BY item.id

我将附件列作为 Blob 类型获取。是否可以将其作为字符串而不是 Blob 获取?

最佳答案

你需要转换成一个字符..

SELECT item.title, GROUP_CONCAT( CAST(CONCAT_WS(',', attachments.id, 
attachments.type, attachments.name ) as CHAR ) ) as attachments
FROM story AS item
LEFT OUTER JOIN story_attachment AS attachments
ON item.id = attachments.item_id GROUP BY item.id

关于sql - 从字符串到 Blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/192028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com