Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

Update Sequence field for a table

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
damixa
Asked:
damixa
  • 3
  • 2
2 Solutions
 
MrC63Commented:
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
 
damixaAuthor Commented:
No, just to run a query that does that. Not neccessarily a trigger, just running a manual query that performs this.
0
 
MrC63Commented:
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
 
damixaAuthor Commented:
yes, there is a primary key. it would be something like ID
0
 
damixaAuthor Commented:
Figured it out by myself, thanks
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now