I have two tables, one called ‘guilds’, and one called *’guild_colours’*. The fields within *guild_colours* are id, and colour (I.E: 1:FFFFFF, 2:000000..), the table guilds has to contain the hex value for the colour. As the available colours inside of *guilds_colours* are ever changing (however previously available colours are acceptable).
I need to run an UPDATE query when a user decides to change the colour of their guild. I started coming up with something like this
UPDATE guilds g
SET g.primarycolour = (SELECT colour FROM guild_colours WHERE id = ? ),
g.secondarycolour = (SELECT colour FROM guild_colours WHERE id = ?)
WHERE g.id = ?
I was wondering if there’s anything faster that I could do?
Try this
Note: I didn’t test it though.