.......?m=customersearch&search=1
wyszukiwanie klientów
Wystąpiły błędy w obsłudze bazy danych!
Zapytanie: SELECT c.id AS id, CONCAT(UPPER(lastname), ' ', c.name) AS customername, status, full_address, address, zip, city, countryid, countries.name AS country, cc.email, ccp.phone, ten, ssn, c.info AS info, extid, message, c.divisionid, c.paytime AS paytime, COALESCE(b.value, 0) AS balance, COALESCE(t.value, 0) AS tariffvalue, s.account, s.warncount, s.online, (CASE WHEN s.account = s.acsum THEN 1 WHEN s.acsum > 0 THEN 2 ELSE 0 END) AS nodeac, (CASE WHEN s.warncount = s.warnsum THEN 1 WHEN s.warnsum > 0 THEN 2 ELSE 0 END) AS nodewarn FROM customerview c LEFT JOIN (SELECT customerid, (GROUP_CONCAT(contact SEPARATOR ',')) AS email FROM customercontacts WHERE (type & 8 > 0) GROUP BY customerid) cc ON cc.customerid = c.id LEFT JOIN (SELECT customerid, (GROUP_CONCAT(contact SEPARATOR ',')) AS phone FROM customercontacts WHERE (type & 5 > 0) GROUP BY customerid) ccp ON ccp.customerid = c.id LEFT JOIN countries ON (c.countryid = countries.id) LEFT JOIN (SELECT SUM(value) AS value, customerid FROM cash GROUP BY customerid ) b ON (b.customerid = c.id) LEFT JOIN (SELECT a.customerid, SUM((CASE a.suspended WHEN 0 THEN (((100 - a.pdiscount) * (CASE WHEN t.value IS null THEN l.value ELSE t.value END) / 100) - a.vdiscount) ELSE ((((100 - a.pdiscount) * (CASE WHEN t.value IS null THEN l.value ELSE t.value END) / 100) - a.vdiscount) * 0 / 100) END) * (CASE t.period WHEN 3 THEN 1 WHEN 5 THEN 1/12.0 WHEN 7 THEN 1/6.0 WHEN 4 THEN 1/3.0 ELSE (CASE a.period WHEN 3 THEN 1 WHEN 5 THEN 1/12.0 WHEN 7 THEN 1/6.0 WHEN 4 THEN 1/3.0 ELSE 0 END) END) ) AS value FROM assignments a LEFT JOIN tariffs t ON (t.id = a.tariffid) LEFT JOIN liabilities l ON (l.id = a.liabilityid AND a.period != 0) WHERE a.commited = 1 AND a.datefrom <= UNIX_TIMESTAMP() AND (a.dateto > UNIX_TIMESTAMP() OR a.dateto = 0) GROUP BY a.customerid ) t ON (t.customerid = c.id) LEFT JOIN (SELECT ownerid, SUM(access) AS acsum, COUNT(access) AS account, SUM(warning) AS warnsum, COUNT(warning) AS warncount, (CASE WHEN MAX(lastonline) > UNIX_TIMESTAMP() - 600 THEN 1 ELSE 0 END) AS online FROM nodes WHERE ownerid > 0 AND ipaddr <> 0 GROUP BY ownerid ) s ON (s.ownerid = c.id) WHERE c.deleted = 0 AND (CONCAT(UPPER(c.lastname), ' ', UPPER(c.name)) LIKE UPPER('%a%') OR (UPPER(address) LIKE UPPER('%a%') OR UPPER(post_address) LIKE UPPER('%a%') OR EXISTS (SELECT 1 FROM customer_addresses ca JOIN vaddresses va ON va.id = ca.address_id AND ca.customer_id = c.id WHERE UPPER(va.address) LIKE UPPER('%a%'))) OR (UPPER(zip) LIKE UPPER('%a%') OR UPPER(post_zip) LIKE UPPER('%a%') OR EXISTS (SELECT 1 FROM customer_addresses ca JOIN vaddresses va ON va.id = ca.address_id AND ca.customer_id = c.id WHERE UPPER(va.zip) LIKE UPPER('%a%'))) OR (UPPER(city) LIKE UPPER('%a%') OR UPPER(post_city) LIKE UPPER('%a%') OR EXISTS (SELECT 1 FROM customer_addresses ca JOIN vaddresses va ON va.id = ca.address_id AND ca.customer_id = c.id WHERE UPPER(va.city) LIKE UPPER('%a%'))) OR EXISTS (SELECT 1 FROM customercontacts WHERE customerid = c.id AND customercontacts.type & 8 = 8 AND contact LIKE '%a%')) ORDER BY customername asc
Błąd: Unknown column 'c.id' in 'on clause'
_______________________________________________
lms mailing list
lms@lists.lms.org.pl
http://lists.lms.org.pl/mailman/listinfo/lms