Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Who can help me with a report in SQL

Status
Not open for further replies.

harfri

Programmer
Mar 5, 2010
17
NL
I have 2 tables and I want to have a report which shows the value in another currency.



Table A (exchange rates)

Date Rate Currency

1-1 1.11 USD
2-1 1.12 USD
3-1 1.13 USD
4-1 1.14 USD
5-1 1.15 USD
6-1 1.16 USD
7-1 1.17 USD


Table B (Account Balance in USD)

DateFrom DateTill Balance Currency

1-1 4-1 100 USD
5-1 7-1 150 USD


The report should show the following details:

Date Rate Currency Balance

1-1 1.11 USD 100
2-1 1.12 USD 100
3-1 1.13 USD 100
4-1 1.14 USD 100
5-1 1.15 USD 150
6-1 1.16 USD 150
7-1 1.17 USD 150 [pre][/pre]
 
Hi

SQL:
[b]select[/b]
er[teal].*,[/teal]
ab[teal].[/teal]balance

[b]from[/b] exchange_rate er
[b]join[/b] account_balance ab [b]on[/b] er[teal].[/teal]date [b]between[/b] ab[teal].[/teal]datefrom [b]and[/b] ab[teal].[/teal]datetill


Feherke.
feherke.github.io
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top