Re: How to pick the oldest row

2004-09-28 Thread Michael Stassen
There are several things wrong here, which makes it a bit difficult to tell what you want. Let's look at the subquery first. SELECT idk FROM `mj_tmp` GROUP BY Concat(ida,u) HAVING Count(Concat(ida,u)) >1 First, you shouldn't use CONCAT() in your GROUP BY, as it breaks the possibility of u

Re: How to pick the oldest row

2004-09-28 Thread Mauricio Pellegrini
Thanks Jim,but that doesn't work for me because the order by performs after the records have been selected. At that time I already have the unwanted row. I will try to explain a little bit further SELECT * FROM `mj_tmp`This select is suposed to return all rows WHERE idk NOT IN but

Re: How to pick the oldest row

2004-09-27 Thread Jim Grill
> 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 FR