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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with search . . plz!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have the following tables in my database:

companies(companyID, Name)
equpiment(equipmentID, Equipment)
companyequipment(ID, companyid, equpimentID)

The database is used to store equpiment possessed by different companies. As you can see, one company can have many pieces of equpiment.

What I now desperately need to do is search the database. I need to be able to search for companies that provide certain equpiment - e.g. find companies that have equpiment of IDs (equpimentID) 1, 2 and 4.

I really don't know how to approach it . .

Plz, plz help somebody.

I'd be exceptionally grateful
 
You can use the QBE grid and join on the fields companyid and EquipmentID drag down the company name then in the criteria type In(1,2,3)

SQL would be something like
SELECT companies.name
FROM(Companies innerjoin on companyequipment.companyid = companies.companyid) innerjoin
equipment.equipmentid = companyequipment.equipmentid
WHERE companyequipment.equipmentid in ('1','3','4')

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top