запрос:
| Код | "SELECT `BrandID`, `BrandName`, `AffiliateID`, `UserName`, `Password`, `MinPayout`, `BrandAPI`, `IsVisible`, `Stars`, `Priority`, `BrandURL`, `BrandImageUrl`, (SELECT COUNT(`AccountID`) FROM `brandaccounts` WHERE `brandaccounts`.`BrandID` = `brands`.`BrandID` ) AS `Leads`, (SELECT COUNT(`AccountID`) FROM `deposits` WHERE deposits.paymentMethod != 'Bonus') AS `FTD`, (SELECT round(SUM(actualBalance),2) FROM `brandaccounts` WHERE brandaccounts.BrandID = brands.BrandID) As `Balance`, (SELECT round(SUM(requests.Outcome),2) FROM requests, brandaccounts WHERE brandaccounts.BrandID = brands.BrandID AND brandaccounts.AccountID = requests.AccountID) As `Gain` FROM `brands` WHERE `PlatformID` = :PlatformID && `PartnerID` = :PartnerID"
|
так работает. Добавляю условие:
| Код |
"SELECT `BrandID`, `BrandName`, `AffiliateID`, `UserName`, `Password`, `MinPayout`, `BrandAPI`, `IsVisible`, `Stars`, `Priority`, `BrandURL`, `BrandImageUrl`, (SELECT COUNT(`AccountID`) FROM `brandaccounts` WHERE `brandaccounts`.`BrandID` = `brands`.`BrandID` ) AS `Leads`, (SELECT COUNT(`AccountID`) FROM `deposits` WHERE deposits.paymentMethod != 'Bonus' && deposits.AccountID = brandaccounts.AccountID) AS `FTD`, (SELECT round(SUM(actualBalance),2) FROM `brandaccounts` WHERE brandaccounts.BrandID = brands.BrandID) As `Balance`, (SELECT round(SUM(requests.Outcome),2) FROM requests, brandaccounts WHERE brandaccounts.BrandID = brands.BrandID AND brandaccounts.AccountID = requests.AccountID) As `Gain` FROM `brands` WHERE `PlatformID` = :PlatformID && `PartnerID` = :PartnerID"
|
получаю ощибку:
автор
| Цитата |
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'brandaccounts.AccountID' in 'where clause'' in /
|
Но у меня нигде нет 'brandaccounts.AccountID'???
В чём дело?? |