Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT t.name AS nombre, COUNT(a.id) AS n,
- concat('|',t.slug_search,'|','-en-','|',u.slug_search) AS routeparam
- FROM neoauto_cartype t INNER JOIN neoauto_carmodel m ON m.type_id = t.id INNER JOIN neoauto_car c
- ON c.model_id=m.id
- INNER JOIN neoauto_carad a ON a.car_id = c.id
- INNER JOIN locations_location u ON u.id = a.location_id WHERE a.STATUS = 3 AND
- t.id IN (5,6,7,8,9,10,11)
- AND u.id not in (3926) and u.parent_id not in (3927,3285,2901,3885,4237,3789)
- GROUP BY (t.name)
- UNION ALL SELECT
- b.name AS nombre , COUNT(a.id) AS n , concat('|',b.slug_search,'|','-en-','|',u.slug_search) AS routeparam
- FROM neoauto_carbrand b
- INNER JOIN neoauto_carmodel m ON m.brand_id = b.id
- INNER JOIN neoauto_car c ON c.model_id=m.id
- INNER JOIN neoauto_carad a ON a.car_id = c.id
- INNER JOIN locations_location u ON u.id = a.location_id WHERE a.STATUS = 3 AND
- b.id IN (403,309,189,287,433,36,240,181)
- AND u.id not in (3926) and u.parent_id not in (3927,3285,2901,3885,4237,3789)
- GROUP BY (b.name);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement