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,'%'
);
答案 0 :(得分:20)
括号内容很重要,因此,请尝试以下方法:
SELECT japanese
FROM edict
WHERE japanese LIKE CONCAT('%',
(SELECT japanese FROM edict WHERE english LIKE 'dog' LIMIT 1),
'%');
但是,告诉我们你收到的错误可能会很好。
答案 1 :(得分:5)
使用:
SELECT a.japanese
FROM EDICT a
JOIN EDICT b ON b.japanese = a.japanese
WHERE b.english LIKE 'dog'
我不建议使用LIMIT,但如果您真的需要它,请使用:
SELECT a.japanese
FROM EDICT a
JOIN (SELECT t.japanese
FROM EDICT t
WHERE t.english LIKE 'dog'
LIMIT 1) b ON b.japanese = a.japanese