Ask Experts Questions for FREE Help!
Ask    ||    Answer
 
Advanced  
 

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Databases > Other Databases   »   Sequential Series Update Query

 
Thread Tools Search this Thread Display Modes
Question
 
 
#1  
Old Mar 27, 2009, 08:35 AM
slapshot_oi's Avatar
slapshot_oi
Senior Member
slapshot_oi is offline
 
Join Date: Feb 2008
Location: Freest state in the union
Posts: 688
slapshot_oi See this member's comment history on his/her Profile page.slapshot_oi See this member's comment history on his/her Profile page.
Sequential Series Update Query

I'm using PHP 5.28 with SQL Server 2005

I'm stuck on a query. I have a task management system with time ranges and I need to recalculate and update all affected records such that every start and stop time is consecutive. Currently, if they user wants to enter a time that conflicts with another, he has to insert a new record with a new time range.

The problem: the user enters a time that falls between an existing time range or one that encompass multiple time ranges.

Existing Table Entries:
START | STOP
1) 8:00 - 9:00
2) 9:00 - 10:30
3) 10:30 - 12:00
4) 12:00 - 3:00

Let's say he wants to update his task table to say that between 9:30 and 10:00 he was on a coffee break, or another case is where he wants to enter a time between 8:30 and 10:00. What I want is for the database to know that the new start time (9:30) replaces the stop time of record (2) and the start time of record (3) and so on.

I want it to look like this:
START | STOP
1) 8:00 - 9:30
2) 9:30 - 10:00
3)10:00 - 10:30
4) 10:30 - 12:00
5) 12:00 - 3:00

I don't know if I should figure out the order in PHP or if there's some tricky SQL I can do, or how many rows really need to be altered. Either way, I feel like I'm reinventing the wheel on this one, someone must have done this before.

Clear as mud?

Reply With Quote
 
     


Your Answer
Email me when someone replies to my answer
Join Login





Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

 
Similar Sponsors


Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Similar Threads
Update Query To increament Records
(6 replies)
New sheet needs new sequential number
(3 replies)
update query
(1 replies)
Update Query in Access
(1 replies)
Ms access update query
(0 replies)

Search this Thread

Advanced Search

Bookmarks

Sponsors



Copyright ©2003 - 2009, Ask Me Help Desk.
All times are GMT -8. The time now is 11:04 PM.