rowid

Equivalent of Oracle’s RowID in MySQL

 ̄綄美尐妖づ 提交于 2019-11-26 14:44:24
is there an equivalent of oracle's rowid in mysql? delete from my_table where rowid not in (select max(rowid) from my_table group by field1,field2) I want to make a mysql equivalent of this query!!! What i'm trying to do is, : The my_table has no primary key.. i'm trying to delete the duplicate values and impose a primary key (composite of field1, field2)..!! In MySql you usually use session variables to achive the functionality: SELECT @rowid:=@rowid+1 as rowid FROM table1, (SELECT @rowid:=0) as init ORDER BY sorter_field But you can not make sorts on the table you are trying to delete from

Equivalent of Oracle’s RowID in MySQL

断了今生、忘了曾经 提交于 2019-11-26 08:52:08
问题 is there an equivalent of oracle\'s rowid in mysql? delete from my_table where rowid not in (select max(rowid) from my_table group by field1,field2) I want to make a mysql equivalent of this query!!! What i\'m trying to do is, : The my_table has no primary key.. i\'m trying to delete the duplicate values and impose a primary key (composite of field1, field2)..!! 回答1: In MySql you usually use session variables to achive the functionality: SELECT @rowid:=@rowid+1 as rowid FROM table1, (SELECT