Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query needs to get data that matches in other tables

Status
Not open for further replies.

dpk136

MIS
Jan 15, 2004
335
US
I have a query that i'm trying to make.

Basically, what needs to happen is this query needs to look for all customers that have certain machines or equipment types, and have purchased them in between 2 dates.

The problem that i'm coming to is that the criteria for which machines to compare the customers to are in a table, the equipment types criteria is in another table and the dates are in another.

Can anyone help?
I would want to show any customers(tblComp) that have any of the machines or any of the equipment type and purchased between the dates

the tables look like this
Code:
tblMachineCrit
********************
*     MachCode     *
*------------------*
* CROLL2           *
* LATHE3           *
* MILL5            *
********************

tblTypeEquip
********************
*    EquipType     *
*------------------*
* END MILL         *
********************

tblDates
************************
* StartDate | EndDate  *
*  5/10/05  | 10/5/06  *
************************

David Kuhn
------------------
 
How do these tables link to the customers (tblComp)??? Without a link to a customer, the data in these three other tables is worthless.
 
the customer table is linked to a machineowned table, this has the machine name. machineowned is linked to a equipment type table that has what type of machine it is. This is connected to the equipment type that i'm looking for.

David Kuhn
------------------
 
HOW do they link to each other??? For example, does the Customer table have a machine ID code that links to the machine table, or does the machine table have a customer ID field that links back to the Customer table? It might help to post the structure of your tables. That way, someone can actually put together a nice little query to meet your needs.
 
David...BTW, are you, by any chance, related to a Steve Kuhn who lives in the Buffalo, NY area?
 
I figured it out. I actually made this harder than it needed to be. It is just a join between a couple of tables (INNER).

The only problem that i'm having is the dates. How do i get it so i only get the dates purchased between the Start and End date in the tblDates table. I'm not sure how this would work.

David Kuhn
------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top