大家好,作为这个查询,我可以在 MYSQL 中工作,但我希望它在 Codeigniter 活动记录中进行转换。
基本上我有3张桌子
- 供应商(与 intCat、intCity、*)
- 类别(带 intId、strCategory、intParent)
- tblcitylist(带有city_id,city_name)
询问:
SELECT category.strCategory AS strParent, Query3. * FROM (
SELECT tblcitylist.city_name AS strCity, Query2. * FROM (
SELECT Query1.intParent, Query1.strCategory, suppliers. * FROM (
SELECT category.strCategory, category.intId, category.intParent FROM
category WHERE ( ( ( category.intParent ) =51 ) ) ) AS Query1 INNER
JOIN suppliers ON Query1.intId = suppliers.intCat ) AS Query2 INNER
JOIN tblcitylist ON Query2.intCity = tblcitylist.city_id ) AS Query3
INNER JOIN category ON Query3.intParent = category.intId
我想从父类别(51)的所有子类别中获取供应商(其类别和父类别名称(strCategory,strParent)和城市名称(city_name as strCity))。
提前致谢。