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

  • Home
  • SEARCH
  • 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 584755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:55:52+00:00 2026-05-13T14:55:52+00:00

I have an SQL Table which consists of 1 column only Column Name A

  • 0

I have an SQL Table which consists of 1 column only

Column Name
A 
A
A
B
B
B
B
C
D
D
E

I need an SQL Code that returns the cut points. For the table above, it will return this:

Column Name
    3
    7
    8
    10
    11

3 is the end of A’s and 7 is the end of B’s and 8 is the end of C’s and so on…

Let’s see what can you come up with :=)

  • 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-05-13T14:55:52+00:00Added an answer on May 13, 2026 at 2:55 pm

    Assuming the data can be sorted on your Column, the plan is to generate a row number for each row and do a group by to retrieve your data points.

    SQL Server 2000

    DECLARE @YourTable TABLE (Col VARCHAR(1))
    CREATE TABLE #TempTable (ID INTEGER IDENTITY(1, 1), Col VARCHAR(1))
    
    SET IDENTITY_INSERT #TempTable OFF
    INSERT INTO @YourTable (Col) VALUES ('A')
    INSERT INTO @YourTable (Col) VALUES ('A')
    INSERT INTO @YourTable (Col) VALUES ('A')
    INSERT INTO @YourTable (Col) VALUES ('B')
    INSERT INTO @YourTable (Col) VALUES ('B')
    INSERT INTO @YourTable (Col) VALUES ('B')
    INSERT INTO @YourTable (Col) VALUES ('B')
    INSERT INTO @YourTable (Col) VALUES ('C')
    INSERT INTO @YourTable (Col) VALUES ('D')
    INSERT INTO @YourTable (Col) VALUES ('D')
    INSERT INTO @YourTable (Col) VALUES ('E')
    
    INSERT INTO #TempTable
    SELECT      *
    FROM        @YourTable
    ORDER BY    Col
    
    SELECT    MAX(ID)
    FROM      #TempTable
    GROUP BY  Col
    
    DROP TABLE #TempTable
    

    SQL Server 2005

    DECLARE @Table TABLE (Col VARCHAR(1))
    
    INSERT INTO @Table VALUES ('A')
    INSERT INTO @Table VALUES ('A')
    INSERT INTO @Table VALUES ('A')
    INSERT INTO @Table VALUES ('B')
    INSERT INTO @Table VALUES ('B')
    INSERT INTO @Table VALUES ('B')
    INSERT INTO @Table VALUES ('B')
    INSERT INTO @Table VALUES ('C')
    INSERT INTO @Table VALUES ('D')
    INSERT INTO @Table VALUES ('D')
    INSERT INTO @Table VALUES ('E')
    
    
    SELECT  MAX(RowNumber)
    FROM    (SELECT RowNumber = ROW_NUMBER() OVER (ORDER BY Col), Col
             FROM   @Table) t
    GROUP BY Col
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 287k
  • Answers 287k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Assuming that by "English characters" you are simply referring to… May 13, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer It's been a long time since I hit this problem… May 13, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer Have a look at MySQL Forums :: ODBC :: Row… May 13, 2026 at 5:08 pm

Related Questions

I have a Tags table whose schema consists of only ID and Name (unique).
I am working with a Drupal 6.x system to create exercise / personal training
I have a table which maintains performance data of a system, each record is
I would like to create an interface for manipulating invoices in a transaction-like manner.
Hey there I got a problem with my code, I compared three ways of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.