Re: [PHP] Mysql query and PHP loops

2003-08-01 Thread Nicholas Robinson
On further reflection, my first attempt works for the specific example but may not in the general case. Try using a combination of max( ...id ) and min( ...val2 ) and add t1.val2 to the group by clause. This might work, but I've deleted my test files now! On Friday 01 Aug 2003 7:04 am, Nicholas

Re: [PHP] Mysql query and PHP loops

2003-07-31 Thread Nicholas Robinson
I think this does what you want. You can probably extend it to do the final check for val3 vs. val2 select distinct t1.val1, max( t1.id ), t1.val2 from table as t1, table as t2 where t1.val2 <= t2.val2 group by t1.val1; HTH On Thursday 31 Jul 2003 3:22 pm, Petre Agenbag wrote: > Hi List >

[PHP] Mysql query and PHP loops

2003-07-31 Thread Petre Agenbag
Hi List I've been trying to do something with one MySQL query, but I don't think it is possible, so, I would need to probably do multiple queries, and possibly have queries inside loops, but I am rather weary of that so, I'd like your views/possible solutions to doing the following: Consider thi