> Hi , I'm trying to fetch the oldest row from a result 
> set in wich the resulting rows have duplicates,
> 
> I need only one row for each duplicate.
> 
> The problem is that I need always the oldest row
> Like in the example
> 
> SELECT *
> FROM `mj_tmp` 
> WHERE idk NOT IN 
>     (SELECT idk FROM `mj_tmp` 
>      GROUP BY Concat(ida,u) 
>      HAVING Count( Concat(ida,u) ) >1 )
> 
> I would like to get the first of this two rows
> but I'm always getting the second.
> 
> idk ida u d
> 90 14450 13 2004-09-08
> 147 14450 13 2004-09-09
> 
> 
> Is there a way in which I can make sure I get always the oldest row?
> 
Try adding something like ORDER BY d DESC LIMIT 1

Jim Grill




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to