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

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

2003-10-17 Thread Andrew Brampton
Hi, I have a client with a database of around 17k entries. Now due to powers out of my control the table structure looks like: CREATE TABLE londonhotelsallphotos ( HotelID double default NULL, active_hotel_photo_Name varchar(255) default NULL, URL varchar(255) default NULL, Number varchar(