gpt4 book ai didi

mysql - 在列名上使用 % 的 LIKE 语句,但行重复

转载 作者:行者123 更新时间:2023-11-29 23:47:53 24 4
gpt4 key购买 nike

我的 SELECT 查询与 LIKE 语句一起使用,但我感到震惊;我提取的行是重复的,我不知道为什么?

SELECT *
FROM questions, counts
WHERE counts.test_coursecode LIKE '%' || questions.coursecode || '%'

最佳答案

您必须包含两个表的内部联接

SELECT *
FROM questions q inner join counts c on a q.id and c.fk
WHERE counts.test_coursecode LIKE CONCAT('%', questions.coursecode, '%')

SELECT *
FROM questions q , counts c
where a q.id and c.fk
and counts.test_coursecode LIKE CONCAT('%', questions.coursecode, '%')

关于mysql - 在列名上使用 % 的 LIKE 语句,但行重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25823036/

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