SELECT * FROM tbl WHERE clm LIKE CONCAT('%',<其他 sql 查询 limit 1>,'%') - 如何?其他>
如何将这两个查询合并为一个?
1)这会找到日语中的狗(犬)符号:
SELECT japanese
FROM edict
WHERE english LIKE 'dog'
LIMIT 1;
2)这会找到所有带有“狗”(犬)符号的日语单词:
SELECT japanese
FROM edict
WHERE japanese LIKE '%犬%';
3)我无法将这两个组合成一个,因为这不会工作?!
SELECT japanese
FROM edict
WHERE japanese
LIKE CONCAT('%',
SELECT japanese FROM edict WHERE english LIKE 'dog' LIMIT 1,'%'
);
How can I combine those two queries into one?
1) This finds the japanese sign for dog (犬):
SELECT japanese
FROM edict
WHERE english LIKE 'dog'
LIMIT 1;
2) This finds all japanese words with the sign for 'dog' (犬) in it:
SELECT japanese
FROM edict
WHERE japanese LIKE '%犬%';
3) I am having trouble combining those two into one, because this doesn't work?!
SELECT japanese
FROM edict
WHERE japanese
LIKE CONCAT('%',
SELECT japanese FROM edict WHERE english LIKE 'dog' LIMIT 1,'%'
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
括号很重要,因此,尝试这样做:
不过,告诉我们您收到的错误可能会更好。
Parenthesises are important, therefore, try this :
It might have been good to tell us what error you received, though.
使用:
我不建议使用 LIMIT,但如果你确实需要它,请使用:
Use:
I don't recommend the use of LIMIT, but if you really need it for this, use: