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

Return only lowest value

Status
Not open for further replies.

ZPBJ

Technical User
Jan 20, 2005
37
US
I am writing a query and want it to return the lowest cost and the associated company by product. I have the costs in one table and the products in another. The tables are linkable on productID. Is there a way to do this in a simple, non-crosstab, query. I'd like to be able to further manipulate the data if necessary.

__________________________________
Remember that time when I took the box? - Peter
 
Is there a way to do this in a simple, non-crosstab, query

yes.

There are several ways to accomplish this. Here's how to start:

Create & save a query that returns the lowest cost for each product:

SELECT productid, min(cost) from CostTable

Now, you can write your main query and join into this query to get the correct cost and product ID. I'm not sure where you are keeping the company (in product or cost?) Do you only get each product from one company?

anyway, this should at least point you in the right direction.

HTH

Leslie

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top