query help

M

Miranda

hi could someone please help me with this query

i have the following tables: projects, materialsUsed, equipmentUsed and
labourUsed. materialsUsed, equip and labour used are associated with the
projects table via a projectID.

the equip, materials and labour tables are set up like this:

equipType, dateUsed, projID....

i need to find out which projectIDs have had some equip, materials or labour
used within a given time frame (which the user enters).

so i have something like this at the moment:

select projID
from projects, materialsUsed, EquipmentUsed
where (projects.projID = materialsUsed.projID and materialsUsed.dateUsed
between forms!...!fromDate and forms!...!toDate) OR (projects.projID =
equipmentUsed.projID and equipmentUsed.date used between forms!...!fromDate
and forms!...!toDate);

this seems to work given that there is data in both the materialsused and
equipmentused tables which falls between the dates. if only one table fits
the criteria i get nothing returned...

any help would be appreciated!!
thanks,
miranda
 
M

Miranda

i just tried to do this using a union query - seems to work but i would be
interested to know if there is another way to do it (similiar to the code i
gave previously)
 

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

Top