ms access - Choosing Correct Dates -


please excuse formatting... working on that.

i trying select correct price of project in query based off appropriate effective date.

for example have table has following information

price table-------------------------

item price effectivedate

  • a $0.57 1/1/17
  • a $0.72 6/1/17

now have production table contains produced day , list out quantity , production production date.

production table-------------------

item quantity productiondate

  • a 100 2/1/17
  • a 100 7/1/17

now when query these want able select appropriate price given productiondate , effectivedate.

what best way achieve this?

try following (first select highest effectivedate lower productiondate, price date):

select preselection.item, price   (select production.item, max(effectivedate) maxeffectivedate production inner join price on price.item = production.item price.effectivedate <= productiondate group production.item) preselection  inner join price on price.item = preselection.item  , price.effectivedate = preselection.maxeffectivedate 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -