MySQL Forums
Forum List  »  Newbie

Re: Update query by group
Posted by: killer b
Date: December 17, 2010 06:53AM

Ok thought that was understandable enouth

Query
SET @temp =0;
UPDATE `jos_bde_10` SET number = @temp := ( @temp +1 );

Query Result
number 	|name 	| class1      
1       John 	 Championship 	
2	David 	 Championship 	
3 	David 	 Clubman	
4 	Chris 	 Clubman  	
5 	Rob 	 Expert 	
6 	Gavin 	 Expert 	
7 	Dean 	 Sportsmen 	
8 	Nicholas Sportsmen

Desired Result
number 	|name 	| class1      
1 	John 	Championship 	
2	David 	Championship
3 	Rob 	Expert
4 	Gavin 	Expert  	
5 	David 	Clubman	
6 	Chris 	Clubman  	
7 	Dean 	Sportsmen 	
8 	Nicholas Sportsmen

Basically need numbers allocated in class1 with the order of Championship, Expert, Clubman, Sportsmen

Options: ReplyQuote


Subject
Written By
Posted
December 17, 2010 06:20AM
December 17, 2010 06:26AM
Re: Update query by group
December 17, 2010 06:53AM
December 17, 2010 07:14AM
December 17, 2010 07:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.