Hi,
I’m trying to run a set of sub-queries,
UPDATE glinks_Wants
SET
want_price_eur = (SELECT eur FROM glinks_Costs WHERE amount = glinks_Wants.want_price AND glinks_Costs.original_currency = glinks_Wants.want_currency),
want_price_gbp = (SELECT gbp FROM glinks_Costs WHERE amount = glinks_Wants.want_price AND glinks_Costs.original_currency = glinks_Wants.want_currency),
want_price_chf = (SELECT chf FROM glinks_Costs WHERE amount = glinks_Wants.want_price AND glinks_Costs.original_currency = glinks_Wants.want_currency),
want_price_usd = (SELECT usd FROM glinks_Costs WHERE amount = glinks_Wants.want_price AND glinks_Costs.original_currency = glinks_Wants.want_currency),
want_price_aud = (SELECT aud FROM glinks_Costs WHERE amount = glinks_Wants.want_price AND glinks_Costs.original_currency = glinks_Wants.want_currency)
…but for some reason nothing is getting set in the glinks_Wants table. I’ve tried it with a simpler version:
UPDATE glinks_Wants SET want_price_gbp = (SELECT gbp FROM glinks_Costs WHERE amount = glinks_Wants.want_price AND glinks_Costs.original_currency = glinks_Wants.want_currency)
…and the same problem. However, if I run the sub-query with values in it, then it gets a
SELECT gbp FROM glinks_Costs WHERE amount = "79.99" AND glinks_Costs.original_currency = "eur"
Any suggestions as to what may be wrong? I really don’t wanna have to go down the route of doing a whole script to update them one by one (a single query is much more appealing!)
TIA
Andy