SELECT * FROM tbl WHERE clm LIKE CONCAT('%',,'%') - HOW?

前端 未结 2 598
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 20:37

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         


        
2条回答
  •  春和景丽
    2021-01-04 21:27

    Use:

    SELECT a.japanese 
      FROM EDICT a
      JOIN EDICT b ON b.japanese = a.japanese
     WHERE b.english LIKE 'dog'
    

    I don't recommend the use of LIMIT, but if you really need it for this, use:

    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
    

提交回复
热议问题