Мне нужно иметь возможность группировать почтовые индексы из Aus_Postcodes в этом запросе выбора, поскольку происходит то, что предложения зацикливаются.
Текущий запрос:
SELECT approved_business.*,
business_stores.*,
group_concat(offer ORDER BY offer ASC SEPARATOR ',') as offers,
Aus_Postcodes.state as AusState
FROM approved_business,
business_stores,
Real_Cash_Offers,
Aus_Postcodes
WHERE approved_business.id = business_stores.business_id AND
Real_Cash_Offers.business_id = approved_business.id AND
Real_Cash_Offers.storeid = business_stores.storeid AND
business_stores.postcode = Aus_Postcodes.postcode AND
approved_business.id = '1288'
GROUP BY approved_business.id
LIMIT 1
ЗдесьПример вывода, я закодировал его в JSON, поскольку это то, что использует наша система.
[{"id":"1288","tradingname":"Loretta Adams Bridal & Evening Wear","listed":"2012-01-26 19:26:24","pictureurl":"","business_id":"1288","storeid":"1","phone":"6139379210","street":"266 Keilor Rd","suburb":"Essendon North","state":"1","postcode":"3041","discription":"","offers":"1000|70,1000|70,1000|70,300|15,300|15,300|15,500|30,500|30,500|30","AusState":"VIC,VIC,VIC,VIC,VIC,VIC,VIC,VIC,VIC"}]