select id, product, min(price), store from tablename group by product
Better?
Regards
Chris
- Original Message -
From: "Ciprian Trofin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 1:24 PM
Subject: Re[2]: Join or smth.
> Do
00 | s1|1 | p3 |
++-+---+---+--+-+
3 rows in set (0.00 sec)
Ric.
- Original Message -
From: "Ciprian Trofin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 12:24 PM
Subject: Re[2]: Join or smth.
create temporary table best_values
select max(product) as prodName, min(price) as bestPrice
from products group by product;
select products.* from best_values,products
where best_values.prodName = products.product
and best_values.bestPrice = products.price;
drop table best_values;
(and note tha
Doesn't work the way I want to: I want the result to be like:
id | product | price | store
1 | p1 | 100 | s1
3 | p1 | 100 | s3
5 | p2 | 95 | s2
7 | p3 | 100 | s1
CL> select * from table_name where product like 'p1' order b
select * from table_name where product like 'p1' order by price limit 1;
- Original Message -
From: "Ciprian Trofin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 11:20 AM
Subject: Join or smth.
> I have a table
I have a table that looks smth. like this:
id product price store
--
1 p1100s1
2 p1120s2
3 p1100s3
4 p2120s1
5 p2 95s2
6 p2300s3
7 p3100s1
8 p3120s2
9