Great. Now just what is it you want to display, GIVEN that sample data??
*********
Just to demo the concept, here's my sample data:
Code:
mysql> select * from prod;
+------------+-----------+-------+
| prodgroup | product | price |
+------------+-----------+-------+
| television | rca | 430 |
| television | lg | 388 |
| microwave | panasonic | 158 |
| microwave | amana | 138 |
| microwave | ge | 169 |
| television | sony | 478 |
+------------+-----------+-------+
And then here is the query I used:
Code:
mysql> select p.prodgroup, p.product, p.price, m.lowest
-> from prod as p, (
-> select prodgroup, min(price) as lowest from prod group by prodgroup
-> ) AS m
-> where p.prodgroup = m.prodgroup
-> order by prodgroup, product, price;
to produce this output:
Code:
+------------+-----------+-------+--------+
| prodgroup | product | price | lowest |
+------------+-----------+-------+--------+
| microwave | amana | 138 | 138 |
| microwave | ge | 169 | 138 |
| microwave | panasonic | 158 | 138 |
| television | lg | 388 | 388 |
| television | rca | 430 | 388 |
| television | sony | 478 | 388 |
+------------+-----------+-------+--------+
So... a list of everything in the "group" (what you were calling "tag"), ordered by price, and showing IN EACH ROW the lowest price in the group.
Not sure that's exactly what you want, and of course it doesn't relate all that well to the expedia data, but the point is that you can do everything in a single query.