lookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I have a basic query

I wish to look up an invoice number in a table and for it to return the date
value,

table 1 invoice range
invoice from - invoice to - period (yymm)
96300 96399 0504
96400 96499 0505

table 2 invoice details
invoice no - value
96301 100
96302 100
96401 100

qry to return
period - value
0504 200
0505 100
 
Robbie,

Try this, untested.

Select IR.Period, SUM(ID.Value) as PeriodValue
FROM [Invoice Range] IR, [Invoice Details] ID
WHERE ID.[Invoice No] BETWEEN IR.[Invoice From] AND IR.[Invoice To]
GROUP BY IR.Period

Hope this Helps

Dale
 

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

Back
Top