Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wybranie MAX z grup
Pyton_000
post
Post #1





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Witajcie. Znowu zaćmienie :/

tabela:
Kod
+---------------+------------------+------+-----+---------+----------------+
| Field         | Type             | Null | Key | Default | Extra          |
+---------------+------------------+------+-----+---------+----------------+
| id            | int(11)          | NO   | PRI | NULL    | auto_increment |
| price_type_id | int(11)          | YES  | MUL | NULL    |                |
| article_id    | int(10) unsigned | YES  | MUL | NULL    |                |
| price         | decimal(12,2)    | YES  |     | NULL    |                |
| update_time   | int(11)          | YES  |     | NULL    |                |
| user_id       | int(11)          | YES  |     | NULL    |                |
+---------------+------------------+------+-----+---------+----------------+


Przykładowe dane:
Kod
+-----+---------------+------------+-------+-------------+---------+
| id  | price_type_id | article_id | price | update_time | user_id |
+-----+---------------+------------+-------+-------------+---------+
| 180 |             1 |        132 | 89.00 |  1297772214 |       1 |
| 181 |             1 |        132 | 99.00 |  1298017081 |       1 |
| 204 |             2 |        132 | 99.00 |  1298017081 |       1 |
+-----+---------------+------------+-------+-------------+---------+


Chcę wyciągnąć price dla każdej grupy (price_type_id) gdzie MAX(update_time) dla grupy

Próbowałem różne rozwiązania ale coś mi nie idzie (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.12.2025 - 02:01