List:MySQL and Perl« Previous MessageNext Message »
From:Doug Pisarek Date:October 15 2009 8:31pm
Subject:Rownum View Function
View as plain text  
I know about the function that list the rownum ( SELECT
@rownum:=@rownum+1 rownum, t.*
FROM (SELECT @rownum:=0) r, mytable t;) which works well but I am unable
to put this in a view. 
I receive this error: ERROR 1351 (HY000): View's SELECT contains a
variable or parameter.
Is there a work arround?
 
Here is the create view statement:
 
 

CREATE OR REPLACE VIEW `c3c_v8_27_dev`.`v_archived_groups` (PK_CUSTOMER,
GROUP_SID, GROUP_VERSION, GROUP_TYPE_CODE, PK_SWITCH, MAX_VERSION,
SEQUENCE_NUMBER) AS

select ing.pk_customer, ing.group_sid, ing.group_version,
ing.group_type_code, ing.pk_switch, v.max_version, @rownum:=@rownum+1
rownum

from in_group ing, 

max_group_version v, 

(SELECT @rownum:=0) r

where ing.group_sid = v.group_sid 

and ing.status_code = 2;

 

Thanks,

Doug P.


Thread
Rownum View FunctionDoug Pisarek15 Oct 2009