Rownum View Function
"Doug Pisarek" <[email protected]> Thu, 15 Oct 2009 13:31:41 -0500
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
------_=_NextPart_001_01CA4DC5.BD605B4D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I know about the function that list the rownum ( SELECT @rownum:=3D@rownum+1 rownum, t.* FROM (SELECT @rownum:=3D0) r, mytable t;) which works well but I am = unable to put this in a view.=20 I receive this error: ERROR 1351 (HY000): View's SELECT contains a variable or parameter. Is there a work arround? =20 Here is the create view statement: =20 =20 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:=3D@rownum+1 rownum from in_group ing,=20 max_group_version v,=20 (SELECT @rownum:=3D0) r where ing.group_sid =3D v.group_sid=20 and ing.status_code =3D 2; =20 Thanks, Doug P. ------_=_NextPart_001_01CA4DC5.BD605B4D--