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 8289681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:33:57+00:00 2026-06-08T12:33:57+00:00

I have a table in sql having two fields ‘JOB_NUMBER’ ‘SRno’, the relation between

  • 0

I have a table in sql having two fields ‘JOB_NUMBER’ ‘SRno’, the relation between the two is such that each job number has many SRNO starting from 1,2,3 and so on,every new Job number has to have a SR no starting form 1,

so my ideal table should some what look like this:

JOB_NUMBER    SRno
   1            1
   1            2 
   1            3
   2            1
   2            2
   3            1 and so on.......

What I want to do is to achive this indexing in sql itself ,can I do this ,is so how?

  • 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-08T12:33:58+00:00Added an answer on June 8, 2026 at 12:33 pm

    If there is another column on the table that is something like a timestamp (e.g. time submitted), then you can do something like:

    select job_number, 
       row_number() over (partition by job_number order by time_submitted asc) as SRno
    from tbl
    

    You could make that into a view and you’re good to go. Keep in mind that this will be sensitive to data modifications (i.e. if someone inserts a row between two other rows, the rows after the inserted one will be “renumbered”). Also keep in mind that this won’t store the SRno on the table; it has to be calculated dynamically.

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

Sidebar

Related Questions

I'm having a problem in a SQL command. I have a table with questions,
I have a table in SQL Server called [Donations] that contains donations given by
I have a table in SQL that links to itself through parentID. I want
I have a query that works perfectly in SQL, but I'm having the damnedest
I happen to have two columns having the same name as two SQL reserved
I have a table with two timestamp fields. I simply defined them with a
I have a Products table in a SQL Server database and I am having
I have a Sql Server 2K8 R2 DB with a table that have a
I have two tables in SQL that I populate into DataTables in C#. They
I have a table in SQL Server 2008 Table Name : tbl_device Table Structure:

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.