Results 1 to 3 of 3

Thread: query

  1. #1
    Join Date
    Nov 2003
    Posts
    33

    Unanswered: query

    need some help on logic part.

    i have 2 colns in table trans_no and cust_no.
    for each trans_no there are for eg. 10 cust_no.

    i need to generate some logic like the system will give me the id for
    each
    cust no per trans no.

    like

    trans_no cust_no system_generate_id
    ------------ ----------- -----------------------------
    123 12 1
    123 137 2
    123 4 3

    124 45 1
    124 147 2

    can someone tell me logic for that
    thanx in advance

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

    select trans_no, cust_no, rank() over (partition by trans_no order by cust_no) rnk
    from mytable;

  3. #3
    Join Date
    Nov 2003
    Posts
    33
    Thank you very much

    That really help me a lot

Posting Permissions

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