sql - access query with multiple where clauses -


i trying run query in access carries out 2 stage currency conversion. takes exchange rate exchange rates table in transactional currency , takes exchange rate of region.

is there way within 1 query. have attempted below getting syntax errors.

update report  set report.[conversion rate] =  (  ( exchange_rates.rate exchange_rates.code = report.[transaction currency code] )  /  ( exchange_rates.rate exchange_rates.code = report.[regional currency code] )  ) 

you can use access update join syntax join exchange rate table report table:

update  (report         inner join exchange_rates tr             on tr.code = report.[transaction currency code])         inner join exchange_rates reg             on reg.code = report.[regional currency code] set     [conversion rate] = tr.rate / reg.rate; 

n.b. need join twice both exchange rates

another option use dlookup function:

update  report  set     [conversion rate] = dlookup("rate", "exchange_rate", "code = " & report.[transaction currency code])                             /                             dlookup("rate", "exchange_rate", "code = " & report.[regional currency code]) 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -