I have entered an "Advanced users SQL query" for one of the tables in phprunner V2.
The normal display of this table is correct. However, when I try to Search, I have problems.
The SQL query is:
SELECT
Companyitem_custom.accountingid as AccountingID,
Company__item.display_name as CompanyName,
AddressPostalitem.street as AddressStreet,
AddressPostalitem.city as AddressCity,
AddressPostalitem.state as AddressState,
AddressPostalitem.postcode as AddressPostcode,
AddressPostalitem.country as AddressCountry
FROM (Companyitem_custom INNER JOIN Companyitem ON Companyitem_custom.custom_id = Companyitem.id) LEFT JOIN AddressPostalitem ON Company__item.contact_id = AddressPostalitem.contact_id WHERE ((((AddressPostalitem.primary_record)=1 AND (Company__item_custom.accountingid)>"")))
As you can see, I have added an "as" statement to each field that I am SELECTing. However, I get the following error. For some reason, phprunner is doing something so that the column in the "as" statement is not recognized.
----- Error displayed ---------
PHP error happened
Technical information
Error type 256
Error description Unknown column 'AddressState' in 'where clause'
URL crm.perfectproof.net/dongle/Companyitem_custom_list.phpa=search&value=1&SearchField=4&SearchOption=Equals&SearchFor=NY
Error file /var/www/html/dongle/include/dbconnection.php
Error line 26
SQL query SELECT Companyitem_custom.accountingid as AccountingID, Company__item.display_name as CompanyName, AddressPostalitem.street as AddressStreet, AddressPostalitem.city as AddressCity, AddressPostalitem.state as AddressState, AddressPostalitem.postcode as AddressPostcode, AddressPostalitem.country as AddressCountry FROM (Companyitem_custom INNER JOIN Companyitem ON Companyitem_custom.custom_id = Companyitem.id) LEFT JOIN AddressPostalitem ON Company__item.contact_id = AddressPostalitem.contact_id WHERE ((((AddressPostal__item.primary_record)=1 AND (Company__item_custom.accountingid)>""))) and (`AddressState`=upper('NY'))