Query pulling Time-Framed values

Q

qtbphilippe

Dear All

I have a Table1 that contains company name field and transactions date
fields, like
CompanyA 1/15/2008
CompanyA 2/25/2008
CompanyA 2/27/2008
CompanyB 6/15/2008
CompanyB 6/25/2008
CompanyB 7/10/2008

I also have Table2 that contains company name flields, tax rate start
date, tax rate end date and tax rate, like:
CompanyA 1/1/2008 1/29/2008 3%
CompanyA 1/30/2008 5/10/2008 5%
CompanyB 1/1/2008 3/29/2008 3%
CompanyA 3/30/2008 7/15/2008 5%

There is no time frame overlap in Table 2

I want to match field names in Table1 with appropriate tax rates,
like
CompanyA 1/15/2008 3%
CompanyA 2/25/2008 5%
CompanyA 2/27/2008 5%
CompanyB 3/15/2008 3%
CompanyB 6/25/2008 5%
CompanyB 7/10/2008 5%

How can I write a query to do this? Thanks.
 
K

KARL DEWEY

Try this --
SELECT Table1.Company, Table1.transactions, Table2.[tax rate]
FROM Table1 LEFT JOIN Table2 ON Table1.Company = Table2.Company
WHERE (((Table1.transactions) Between [tax rate start] And [tax rate end]))
ORDER BY Table1.Company, Table1.transactions;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top