The only join I can see that is common to both tables is the date value, you can join on that and then use a CASE
expression to choose the appropriate value from tableA
based on the value in tableB
SELECT CASE WHEN b.Currency = 'USD' THEN a.USD ELSE a.EUR END as [Amount]
FROM tableA AS a
INNER JOIN tableB AS b
ON b.Date = a.Date
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…