Advertisement
slovacus

consulta para neoauto otras ciudades

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