November 22, 2007 at 3:34 am
Does anyone know how I could take a weeks entries in a table and copy and insert the same entries into the same table but with the starting date a week on.
class_id class_dte class_start_time class_end_time class_name class_def_id
6 21/11/2007 13:25 19/11/2007 11:00 19/11/2007 12:00 Spanish 1
8 21/11/2007 14:44 19/11/2007 12:00 19/11/2007 13:00 French 1
9 21/11/2007 14:48 19/11/2007 16:30 19/11/2007 17:30 Maths 3
10 21/11/2007 15:49 19/11/2007 17:30 19/11/2007 18:30 English 1
11 21/11/2007 15:55 20/11/2007 11:00 20/11/2007 12:00 English Literature 5
So that I could make a carbon copy of one weeks lessons and move them on a week.
Thanks in advance
November 22, 2007 at 6:05 am
INSERT INTO schedule
SELECT class_id
, class_dte
, DATEADD(day, 7, class_start_time)
, DATEADD(day, 7, class_end_time)
, class_name
, class_def_id
FROM schedule
WHERE class_start_time BETWEEN '19/11/2007'
AND '21/11/2007'
Regards,
Andras
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply