Serial number for rows

Hi,
How do i generate serial numbers for the rows selected using 'select' command??
Bye..

Comments

  • There are several ways to do that like by using a temporary table,self join , cursor etc.

    the simplest way is by using the selfjoin in select statement.

    select count(*) Rec_No, alias1.fieldname from table_name alias1 join table_name alias2 on alias1.field>=alias2.field
    group by alias.fieldname
    order by alias.filed name

    let me know whether it helps or not.


    : Hi,
    : How do i generate serial numbers for the rows selected using 'select' command??
    : Bye..
    :

  • : Hi,
    : How do i generate serial numbers for the rows selected using 'select' command??

    What exactly do you mean by "serial number"?

    select rownum, column1, column2
    from table1

    rownum is a built-in pseudo-function that will return 1 for the first row, 2 for the second, etc.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • u can make use of sequences
    use count()....., sequence.....and select ...
    bye.....
    busy quering....................
    -ana






    Hi,
    : How do i generate serial numbers for the rows selected using 'select' command??
    : Bye..
    :

  • To use Rowid,rownum but don't use sequence because same sequence is used some other program,so the order may changed
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories