Skip to content

Instantly share code, notes, and snippets.

@vadv
Created March 19, 2015 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vadv/c4140aba4efabc5f9f95 to your computer and use it in GitHub Desktop.
Save vadv/c4140aba4efabc5f9f95 to your computer and use it in GitHub Desktop.
SELECT DISTINCT `location_district`.`id`,
`location_district`.`name`,
`location_district`.`name_ru`,
`location_district`.`name_en`,
`location_district`.`nameslug`,
`location_district`.`lat`,
`location_district`.`lon`,
`location_district`.`zoom`,
`location_district`.`country_id`,
`location_district`.`region_id`,
`location_district`.`city_id`
FROM `location_district`
WHERE `location_district`.`id` IN
(SELECT U3.`district_id`
FROM `transport_vehicle` U0
INNER JOIN `transport_vehiclepark` U1 ON (U0.`park_id` = U1.`id`)
LEFT OUTER JOIN `gpsreceiver_vehiclegpsreceiver` U2 ON (U0.`gps_supplier_id` = U2.`id`)
INNER JOIN `transport_vehicleenterprise` U3 ON (U1.`enterprise_id` = U3.`id`)
WHERE (U0.`id` LIKE '%29555%'
OR U0.`registration_code` LIKE '%29555%'
OR U1.`name` LIKE '%29555%'
OR U0.`park_code` LIKE '%29555%'
OR U2.`name` LIKE '%29555%'
OR U2.`code` LIKE '%29555%'
OR U0.`gps_device_code` LIKE '%29555%'))
ORDER BY `location_district`.`name` ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment