i have three tables and want to run INNER JOIN and IN clause on them. can anyone tell me where i am doing wrong
我有三个表,想要运行内连接和子句。谁能告诉我我哪里做错了吗
SELECT `tblinvoices`.id,`tblinvoices`.userid,`firstname`,`lastname`
FROM `tblinvoices`
WHERE `paymentmethod`IN
(SELECT `gateway` FROM `tblpaymentgateways` WHERE `setting`='type' AND `value` = 'CC')
INNER JOIN `tblclients` ON `tblinvoices`.userid=`tblclients`.id"
1 个解决方案
#1
4
JOIN comes before WHERE:
加入之前所在:
SELECT tblinvoices.id,
tblinvoices.userid,
firstname,
lastname
FROM
tblinvoices
INNER JOIN tblclients
ON tblinvoices.userid = tblclients.id
WHERE
paymentmethod IN
(select gateway
FROM tblpaymentgateways
WHERE setting='type'
AND value = 'CC')
#1
4
JOIN comes before WHERE:
加入之前所在:
SELECT tblinvoices.id,
tblinvoices.userid,
firstname,
lastname
FROM
tblinvoices
INNER JOIN tblclients
ON tblinvoices.userid = tblclients.id
WHERE
paymentmethod IN
(select gateway
FROM tblpaymentgateways
WHERE setting='type'
AND value = 'CC')