Results 1 to 2 of 2

Thread: sql report

  1. #1
    Join Date
    Oct 2002
    Posts
    1

    Question Unanswered: sql report

    I have a query : - How do I generate serial nos. to the records generated by an sql command. I have used order by in the query. I want to send the result set as a report to user and need to show seial nos. in the report.
    Thanks in advance.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: sql report

    Originally posted by manishaj
    I have a query : - How do I generate serial nos. to the records generated by an sql command. I have used order by in the query. I want to send the result set as a report to user and need to show seial nos. in the report.
    Thanks in advance.
    It depends on your DBMS and/or reporting tool.

    If you are using a cursor and fetching rows, you can just count the rows fetched yourself.

    If you are using a reporting tool, it may have its own way of doing this.

    If you are using Oracle, you can use ROWNUM:

    SELECT ROWNUM, a, b, c FROM
    ( SELECT a, b, c, FROM ... ORDER BY ... );

    If you are using a non-Oracle DBMS, it may have a similar facility.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •