Solved

Update Sequence field for a table

Posted on 2013-06-25
5
323 Views
Last Modified: 2013-06-26
So i have a table with lets say four fields on table1

Date
Group
Status
Sequence_number

i need to update the sequence grouping the fields by the other three fields.

so if there are 4 records where Date, Group and Status are the same,  the Sequence_number would start at 101, 102, 103, 104 then start again at 101 for the next group of records where these three fields are the same.

thanks in advance
0
Comment
Question by:damixa
  • 3
  • 2
5 Comments
 
LVL 4

Assisted Solution

by:MrC63
MrC63 earned 500 total points
ID: 39276410
What do you expect to trigger this event / update?  Should it take place when you save a new record?  If that's the case, then perhaps you can explain how you're accessing the SQL database and/or storing the new record?
0
 

Author Comment

by:damixa
ID: 39276420
No, just to run a query that does that. Not neccessarily a trigger, just running a manual query that performs this.
0
 
LVL 4

Accepted Solution

by:
MrC63 earned 500 total points
ID: 39276553
Does this table presently have a unique ID key field, or is it only the 4 fields (and perhaps a few others) you've mentioned?
0
 

Author Comment

by:damixa
ID: 39276985
yes, there is a primary key. it would be something like ID
0
 

Author Closing Comment

by:damixa
ID: 39278849
Figured it out by myself, thanks
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL View Syntax case etc 5 34
Help Required 2 29
mysql to shows result of all other id in another colunm if id select in table 3 24
sql server insert 12 28
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now