SQL Inner Join问题

时间:2012-08-11 03:26:01

标签: mysql sql join inner-join

目前我有以下命令:

SELECT * FROM `clients` 
WHERE `ID`=(SELECT `clientID` 
            FROM `websites` 
            WHERE `name` LIKE "%my name%") 
LIMIT 0,20

我希望使用内连接,因为AFAIK应该如何处理。

我不知道怎么做......这就是我能想到的:

SELECT * 
FROM `clients` 
WHERE INNER JOIN `websites` ON `websites`.`name` LIKE "%lead%" 
LIMIT 0,20

1 个答案:

答案 0 :(得分:4)

SELECT c.* FROM `clients` c
INNER JOIN `websites` w ON w.clientID = c.ID
WHERE w.`name` LIKE '%lead%'
LIMIT 0,20