Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8550735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:01:19+00:00 2026-06-11T14:01:19+00:00

I have a Column 1 which in this case is the same value repeating

  • 0

I have a Column 1 which in this case is the same value repeating through all the rows. Column 2 has non distinct rows in which values may repeat. I want to create a column named Group to show that the rows belong to this group in seqential order (Ordered by Column 2). Basically, I need to create an output that looks similar to this:

Column 1   | Column 2   | Group
--------------------------------
100        | AA         | 1
100        | AA         | 1
100        | AA         | 1 
100        | BB         | 2
100        | BB         | 2
100        | CC         | 3
100        | DD         | 4
100        | DD         | 4
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:01:20+00:00Added an answer on June 11, 2026 at 2:01 pm

    You could use the dense_rank function in oracle.

    select col1,
           col2,
           dense_rank () over (partition by col1
                             order by col2) group_column
      from test_table;
    
          COL1 CO GROUP_COLUMN
    ---------- -- ------------
           100 AA            1
           100 AA            1
           100 AA            1
           100 BB            2
           100 BB            2
           100 CC            3
           100 DD            4
           100 DD            4
    

    You could use “order by col1, col2” to verify the results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For each row I have a column which contains numbers like this 1,4,6,3,16,13 .
I have an xml column which contain data like this: <AuthorList CompleteYN=Y> <Author ValidYN=Y>
In my database I have a time stamp column...which reflects a format like this:
I currently have this code which stores XML into an XML-type column called data,
I have this query which returns a result set with Date(column) as nvarchar datatype.
I have a textbox which is binded to a specific database table column. This
i have a notes column which contains text and has an id within the
I have four data.frames which all have the same columns, being the first the
I have a melted dataset containing a column value which represent an absolute number
i have a column in wich the result appears like this: Column 1 999999999990

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.