Hi Louis, One little bit advance question with respect to my previous question. Say for example, my sql returns total 100 records in that it returns 10 records for every employee. Here I would I display Row_Number as 1 for first 10 records i.e. for first employee, then for next 10 records i.e. for second employee Row_Number as 2, and so on. So finally Row_Number value should endup with 10. Any idea how would it possible? Thanks In Advance.
With Best Regards. Vishal On Friday, 13 March 2015 6:07 PM, Vishal Tiwari <vishuals...@yahoo.co.in> wrote: Thank You So Much !!!! Louis van Alphen.... You saved me.... Thanks A Ton Again !!!!!! On Friday, 13 March 2015 5:50 PM, "'Louis van Alphen' lo...@nucleo.co.za [firebird-support]" <firebird-support@yahoogroups.com> wrote: select cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer) as row_number, rdb$set_context('USER_TRANSACTION', 'row#', coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer), 0) + 1), < other columns> from MY_TABLE From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] Sent: 13 March 2015 01:58 PM To: firebird-support@yahoogroups.com Subject: [firebird-support] How To Generate Auto Increment Number in SQL Itself ? Hi All, I have one question, any SQL I write, I would like to get auto-increment number (separate column obviously) to every row starting with 1. It is just to numbering every record I get as an output of my sql. I do not want to use Generate which we do on table. This is just for SQL output I need. Thanks In Advance. With Best Regards. Vishal [Non-text portions of this message have been removed] #yiv7366762412 -- #yiv7366762412ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv7366762412 #yiv7366762412ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv7366762412 #yiv7366762412ygrp-mkp #yiv7366762412hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv7366762412 #yiv7366762412ygrp-mkp #yiv7366762412ads {margin-bottom:10px;}#yiv7366762412 #yiv7366762412ygrp-mkp .yiv7366762412ad {padding:0 0;}#yiv7366762412 #yiv7366762412ygrp-mkp .yiv7366762412ad p {margin:0;}#yiv7366762412 #yiv7366762412ygrp-mkp .yiv7366762412ad a {color:#0000ff;text-decoration:none;}#yiv7366762412 #yiv7366762412ygrp-sponsor #yiv7366762412ygrp-lc {font-family:Arial;}#yiv7366762412 #yiv7366762412ygrp-sponsor #yiv7366762412ygrp-lc #yiv7366762412hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv7366762412 #yiv7366762412ygrp-sponsor #yiv7366762412ygrp-lc .yiv7366762412ad {margin-bottom:10px;padding:0 0;}#yiv7366762412 #yiv7366762412actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv7366762412 #yiv7366762412activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv7366762412 #yiv7366762412activity span {font-weight:700;}#yiv7366762412 #yiv7366762412activity span:first-child {text-transform:uppercase;}#yiv7366762412 #yiv7366762412activity span a {color:#5085b6;text-decoration:none;}#yiv7366762412 #yiv7366762412activity span span {color:#ff7900;}#yiv7366762412 #yiv7366762412activity span .yiv7366762412underline {text-decoration:underline;}#yiv7366762412 .yiv7366762412attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv7366762412 .yiv7366762412attach div a {text-decoration:none;}#yiv7366762412 .yiv7366762412attach img {border:none;padding-right:5px;}#yiv7366762412 .yiv7366762412attach label {display:block;margin-bottom:5px;}#yiv7366762412 .yiv7366762412attach label a {text-decoration:none;}#yiv7366762412 blockquote {margin:0 0 0 4px;}#yiv7366762412 .yiv7366762412bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv7366762412 .yiv7366762412bold a {text-decoration:none;}#yiv7366762412 dd.yiv7366762412last p a {font-family:Verdana;font-weight:700;}#yiv7366762412 dd.yiv7366762412last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv7366762412 dd.yiv7366762412last p span.yiv7366762412yshortcuts {margin-right:0;}#yiv7366762412 div.yiv7366762412attach-table div div a {text-decoration:none;}#yiv7366762412 div.yiv7366762412attach-table {width:400px;}#yiv7366762412 div.yiv7366762412file-title a, #yiv7366762412 div.yiv7366762412file-title a:active, #yiv7366762412 div.yiv7366762412file-title a:hover, #yiv7366762412 div.yiv7366762412file-title a:visited {text-decoration:none;}#yiv7366762412 div.yiv7366762412photo-title a, #yiv7366762412 div.yiv7366762412photo-title a:active, #yiv7366762412 div.yiv7366762412photo-title a:hover, #yiv7366762412 div.yiv7366762412photo-title a:visited {text-decoration:none;}#yiv7366762412 div#yiv7366762412ygrp-mlmsg #yiv7366762412ygrp-msg p a span.yiv7366762412yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv7366762412 .yiv7366762412green {color:#628c2a;}#yiv7366762412 .yiv7366762412MsoNormal {margin:0 0 0 0;}#yiv7366762412 o {font-size:0;}#yiv7366762412 #yiv7366762412photos div {float:left;width:72px;}#yiv7366762412 #yiv7366762412photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv7366762412 #yiv7366762412photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv7366762412 #yiv7366762412reco-category {font-size:77%;}#yiv7366762412 #yiv7366762412reco-desc {font-size:77%;}#yiv7366762412 .yiv7366762412replbq {margin:4px;}#yiv7366762412 #yiv7366762412ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv7366762412 #yiv7366762412ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv7366762412 #yiv7366762412ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv7366762412 #yiv7366762412ygrp-mlmsg select, #yiv7366762412 input, #yiv7366762412 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv7366762412 #yiv7366762412ygrp-mlmsg pre, #yiv7366762412 code {font:115% monospace;}#yiv7366762412 #yiv7366762412ygrp-mlmsg * {line-height:1.22em;}#yiv7366762412 #yiv7366762412ygrp-mlmsg #yiv7366762412logo {padding-bottom:10px;}#yiv7366762412 #yiv7366762412ygrp-msg p a {font-family:Verdana;}#yiv7366762412 #yiv7366762412ygrp-msg p#yiv7366762412attach-count span {color:#1E66AE;font-weight:700;}#yiv7366762412 #yiv7366762412ygrp-reco #yiv7366762412reco-head {color:#ff7900;font-weight:700;}#yiv7366762412 #yiv7366762412ygrp-reco {margin-bottom:20px;padding:0px;}#yiv7366762412 #yiv7366762412ygrp-sponsor #yiv7366762412ov li a {font-size:130%;text-decoration:none;}#yiv7366762412 #yiv7366762412ygrp-sponsor #yiv7366762412ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv7366762412 #yiv7366762412ygrp-sponsor #yiv7366762412ov ul {margin:0;padding:0 0 0 8px;}#yiv7366762412 #yiv7366762412ygrp-text {font-family:Georgia;}#yiv7366762412 #yiv7366762412ygrp-text p {margin:0 0 1em 0;}#yiv7366762412 #yiv7366762412ygrp-text tt {font-size:120%;}#yiv7366762412 #yiv7366762412ygrp-vital ul li:last-child {border-right:none !important;}#yiv7366762412