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

Only pulling one of multiple values from a query

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I have a many-to-many relationship in my database. Each Job can be related to many facilities and each facility can be related to many different jobs. I have a "Job" table, a "Facility" table and a "JobFacility" table that keeps track of these relationships.

For example, I have job #1 which is related to Anderson Boilers and Pelzer Refineries.

I want to create a report that will list all of the jobs and various information. I want the report to display the first facility that the job is related to and to disregard all the other facilities. (The reason being that most of the time each job will have one facility, but every once in a while one job will have 4+ facilities and we want the report to be consistent.)

Does anyone know how I can structure my query so that I just pull out the first value? Does this make any sense?
 
I would make the query "totals" query then set the "Total:" row in the QBE grid to "First" or "Min" or "Max".

Troy
 
I think I figured it out... if I do a SELECT TOP 1 FROM MyTable, then that will select the first value. sweet! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top