Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011
    Posts
    3

    Unanswered: Update a field by getting last 2 digits of a number

    Hi,

    This is how my table looks like

    number flag address
    1234567890212 06 N ABCroad
    1234567890212 05 P DEFroad
    1234567890123 03 Y GHIroad
    1234567890123 02 N JKLroad

    output needed:

    number flag address
    1234567890212 06 N ABCroad
    1234567890212 05 P ABCroad
    1234567890123 03 Y GHIroad
    1234567890123 02 N GHIroad

    - I need to check the first 13 digits of the number with other records of the table, if it matches, i need to take the last 2 digits and check if there is any preceding last 2 digits in any other record.
    - for eg, 06 and 05 (as shown above), then i need to update the address of 05 record with the address of 06 record
    - the flow should be
    06--updates 05 record
    05--updates 04 record
    04--updates 03 record and so on...
    this should happen for 01 to 99 (last 2 digits of the number)


    I tried using selfjoin but cross join is happening.
    How can i achieve this output.
    Any help will be appreciated.

    Thanks in advance

  2. #2
    Join Date
    Feb 2012
    Posts
    133
    can you send us your sql statement

Posting Permissions

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