select distinct mysql
| From: | kale | Date: | Thu, 15 Aug 2002 10:12:59 +0000 |
| Subject: | select distinct mysql | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-112727@lists.php.net to get a copy of this message | ||
hy,
I have a tabel (history) with fields:
id (uniq), date, time, name, etc.
I want to select after next rules:
- date and time been sort descendent
- only 10 recording
- value of the field name to be unique
syntax must be something this:
SELECT *, DISTINCT name FROM history
ORDER date DESC, time DESC LIMIT 10
but this not work. how can I do this?
this is structure of tabel:
id name date time ...etc
----------------------------------------------
1. kale 2002-03-15 14:12_14 ....
2. smith 2002-04-17 15:14:13 ....
3. kale 2002-05-15 16:14:13 .....
I want that result contains only recordings 2 and 3
not 1 because it's same name and it is older then 3.
I use a mysql server.
thanks for help
kale