gpt4 book ai didi

mySQL JOIN 将文本添加到变量

转载 作者:行者123 更新时间:2023-11-30 01:11:02 24 4
gpt4 key购买 nike

这是一个 mySQL 查询。麻烦的是我们需要给 theme.ref 添加前缀和后缀才能使其匹配

SELECT * FROM content LEFT JOIN theme ON content.ID LIKE theme.ref 
WHERE content.status = 1 AND content.parent = 11 AND content.type = 'team'
ORDER BY content.position ASC

在显示 content.ID LIKE theme.ref 的第一个链接上,是否可以在 theme.ref 之前添加文本“ID”,在其之后添加“,”。这可以做到吗?如果可以的话如何做到。

例如。 'ID'.theme.reg.',' 显然这是行不通的。

最佳答案

content.ID LIKE concat('ID',theme.ref,',')(如果 theme.ref 不包含通配符,则相当于 content.ID = concat('ID',theme.ref,','))

但是查询效率会很低。也许,它应该被重写或者整个数据模型被改变。

关于mySQL JOIN 将文本添加到变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19466771/

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