Suddenly I face this issue. I want to pass data to Subquery but it showing some error. There is my Code.
SELECT transaction.TrnID as NeedTopass
FROM transaction
WHERE `Creditor` = '130' AND
(SELECT meta.MetaValue FROM meta WHERE meta.Parent = NeedTopass) = '505'
But it's showing this error.
Unknown column 'NeedTopass' in 'where clause'
join is you friend:
NOTE: you only must quote strings. if '505' a number its not necessary
SELECT transaction.TrnID as NeedTopass
FROM transaction t
LEFT join meta m ON m.Parent = t.TrnID
WHERE `Creditor` = '130'
AND m.MetaValue = '505';
USE `` this symbol before transaction
SELECT `transaction`.`TrnID`,`meta`.`MetaValue`
FROM `transaction` LEFT JOIN `meta` ON(`meta`.`Parent`=`transaction`.`TrnID`)
WHERE `Creditor` = '130' AND `meta`.`MetaValue`='505'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.