SA-MP Forums Archive
Help about MySQL Query - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help about MySQL Query (/showthread.php?tid=657973)



Help about MySQL Query - GospodinX - 19.08.2018

Hi guys,

I want to delete all Vehicles which are not on player slot's.For all players I store ID of vehicle:
Код:
Vehicle1
Vehicle2
Vehicle3
Vehicle4
Vehicle5
And I have another table for Vehicle.
Код:
ID
So If an of ID(From Vehicle) is not on any player slot I want to delete them.Because sometime's we are just delete car from slot and not from table Vehicle.Because I will change system I need to delete all vehicles which are not on player slot and I don't know how to do it.


Re: Help about MySQL Query - GospodinX - 19.08.2018

I'm found way to SELECT all Vehicles which are on player slot..But I need to delete vehicles which are not on any slot...

Код:
SELECT bu.ID FROM vehicle bu inner join users u where u.Vehicle1 = bu.ID || u.Vehicle2 = bu.ID || u.Vehicle3 = bu.ID || u.Vehicle4 = bu.ID || u.Vehicle5 = bu.ID