Re: [PHP] SQL Query OT question for the experts :)

2003-10-17 Thread Nicholas Robinson
The following works in MySQL, but obviously (and unlike your client!) you'll want to do this on a copy of the table first... update londonhotelsallphotos set Number = ( if (@hi != HotelID, @line := 1, @line := @line + 1)), HotelID = (@hi := HotelID) Note that if you run this query more than onc

Re: [PHP] SQL Query OT question for the experts :)

2003-10-17 Thread Marek Kilimajer
I think you (or me) will make some php code out of kindness. Order the rows by the id (still there should be some REALLY uniq id) ad then update the same row with a variable that you reset each time that you encounter new id. $i=0; while($row=...) { if($prev != $row['HotelID']) { $i=0; $pr