You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何基于关键词筛选SQL数据:获取Resolved到Closed状态的行

解决方案

很简单,你只需要在原查询的WHERE条件里再加个过滤规则,精准匹配你需要的Logcomments内容就行。注意因为目标字符串里包含单引号,SQL里得用两个单引号来转义内部的单引号,不然会触发语法错误。

修改后的查询语句

SELECT createdby, Date, LogAgent, Logcomments 
FROM ticketsdata 
WHERE ticketnumber='123456' 
  AND Logcomments='Status changed from ''Resolved'' to ''Closed'''

执行后得到的目标结果

createdbyDateLogAgentLogcomments
AAAAA12/02/2013RamuStatus changed from 'Resolved' to 'Closed'

内容的提问来源于stack exchange,提问作者vissubabu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:15:24