query help

  • Thread starter Thread starter Miranda
  • Start date Start date
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
 
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)
 
Back
Top