MySQL Forums
Forum List  »  Partitioning

Re: Mysql supports 'partition by' analytical function?
Posted by: Scott Noyes
Date: October 08, 2008 08:21AM

SET @oldCol1 = '', @rowNum = 0;

SELECT
col1,
col2,
@rowNum := IF(@oldCol1 <=> col1, @rowNum + 1, col1 <=> (@oldCol1 := col1)) AS rate_index
FROM
table1
ORDER BY
col1,
col2;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Mysql supports 'partition by' analytical function?
2467
October 08, 2008 08:21AM


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.