On 28-7-2016 04:49, 'hz.yb' [email protected] [firebird-support] wrote: > > > i want to get rownum?how to select?thanks > > table: > CREATE TABLE PZ ( > ID INTEGER NOT NULL, > RQ TIMESTAMP NOT NULL, > JE DECIMAL(18,2), > /* Keys */ > PRIMARY KEY (ID) > ); > > data: > INSERT INTO PZ (ID, RQ, JE) VALUES (11, '2016-01-01 23:55:00', 84.38); > INSERT INTO PZ (ID, RQ, JE) VALUES (12, '2016-01-02 23:55:00', 37.97); > > i want to get rownum(ORDER BY RQ),for example: > > ROWNUM ID RQ JE > 1 11 2016-01-01 23:55:00 84.38 > 2 12 2016-01-02 23:55:00 37.97 > > HOW TO SELECT?
You need Firebird 3, and use ROW_NUMBER(), see also the Firebird 3 release notes http://www.firebirdsql.org/file/documentation/release_notes/html/en/3_0/rnfb30-dml-windowfuncs.html#d0e5417 example select row_number() over() as rownum, id, rq, je from pz Mark -- Mark Rotteveel
