04.03.2013, 17:35
Good tutorial. SERIAL alias is nice for ids (however it uses bigint, so your is better for most cases). One thing though: NO ACTION - it really means same thing as restrict?
#sidenote:
Example of fetching related data in single query (all mods for vehicle at specific spawnpoint)
Load vehicle models and check optionally if the vehicle has mod with id 512351
Yup - no where clause, or it won't return vehicle data. If there isn't mod with id 512351, then the vm.mod_model will return null.
Moar info to be found via ******.
#sidenote:
Example of fetching related data in single query (all mods for vehicle at specific spawnpoint)
Quote:
SELECT t0.mod_model FROM `vehicle_mods` t0 LEFT JOIN `vehicle_info` t1 ON t1.r_id = t0.r_id WHERE t1.spawnx = %.2f AND t1.spawny = %.2f AND t1.spawnz = %.2f |
Quote:
SELECT vi.r_id, vi.modelid, vm.mod_model FROM `vehicle_info` vi LEFT JOIN `vehicle_mods` vm ON vm.r_id = vi.r_id AND vm.mod_model = 512351 |
Moar info to be found via ******.