mysql - 查找精确匹配记录和字符串包含第 1 列行单词

标签 mysql sql

我有 2 列 abc 和 bcd 我想将 abc 数据与 bcd 列完全匹配且句子包含 abc 进行比较。

I have 2 columns abc and bcd i want to compare abc data with bcd column exact match and sentence contain word

预期结果

enter image description here

最佳答案

您是否尝试选择存在 abc 与行 bcd 匹配的行的所有行?然后使用EXISTS

select *
from mytable
where exists
(
  select null
  from mytable other
  where mytable.bcd like concat('%', other.abc, '%')
)
order by abc, bcd;

关于mysql - 查找精确匹配记录和字符串包含第 1 列行单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59382159/

相关文章:

mysql - sql根据在mysql中找到的记录显示分区

mysql - 如何在每个 INSERT 或 DELETE 查询执行上将所有 ID AUTO Increment 重置为序列值..!

php - MYSQL PHP Where查询错误

mysql - 需要在 ubuntu 中配置 mysql 集群的教程 (lucid)

javascript - 如何获取客户端的sql列值总和?

sql - 在 Azure CosmosDB SQL 查询中将 TimeScript 转换为日期

Sql 触发器 - 它属于哪个表?

SQL Server错误: "Cannot insert explicit value for identity column" even when I SET IDENTITY_INSERT ON

SQL2008 无分词器的全文索引搜索

php - 如何使 HHVM 的 MySQL 驱动程序将 ID 返回为整数?