Click here to Skip to main content
15,891,409 members
Home / Discussions / Database
   

Database

 
GeneralRe: A loop in T-SQL ? Pin
Colin Angus Mackay16-Nov-04 10:04
Colin Angus Mackay16-Nov-04 10:04 
GeneralDELETE X WHERE Y IN (SubQuery) Problem Pin
Tristan Rhodes16-Nov-04 0:55
Tristan Rhodes16-Nov-04 0:55 
GeneralRe: DELETE X WHERE Y IN (SubQuery) Problem Pin
Colin Angus Mackay16-Nov-04 1:38
Colin Angus Mackay16-Nov-04 1:38 
GeneralRe: DELETE X WHERE Y IN (SubQuery) Problem Pin
Tristan Rhodes16-Nov-04 3:17
Tristan Rhodes16-Nov-04 3:17 
GeneralRe: DELETE X WHERE Y IN (SubQuery) Problem Pin
Colin Angus Mackay16-Nov-04 5:46
Colin Angus Mackay16-Nov-04 5:46 
QuestionHow to import both adoce31.dll & adoxce31.dll? Pin
george ivanov16-Nov-04 0:53
george ivanov16-Nov-04 0:53 
GeneralDeclare Varibales In SQL 2000 Pin
Hemant Mane15-Nov-04 19:03
Hemant Mane15-Nov-04 19:03 
GeneralSequential Dates and Grouping Pin
Peet Schultz15-Nov-04 2:47
Peet Schultz15-Nov-04 2:47 
Hi All

We have a table with a persons Employee number (Resource tag) , Date Worked and the Shift Worked on that date.

Like So

resource tag date worked shift type

------------ ------------------------------------------------------ --------------------------------------------------
125197584 2004-07-14 00:00:00.000 Night
125197584 2004-07-15 00:00:00.000 Night
125197584 2004-07-16 00:00:00.000 Night
125197584 2004-07-17 00:00:00.000 Night
125197584 2004-07-18 00:00:00.000 Morning
125197584 2004-07-19 00:00:00.000 Morning
125197584 2004-07-20 00:00:00.000 Morning
125197584 2004-07-21 00:00:00.000 Morning
125197584 2004-07-22 00:00:00.000 Morning
125197584 2004-07-23 00:00:00.000 Morning
125197584 2004-07-24 00:00:00.000 Morning
125197584 2004-07-25 00:00:00.000 Night
125197584 2004-07-26 00:00:00.000 Night
125197584 2004-07-27 00:00:00.000 Night
125197584 2004-07-28 00:00:00.000 Night
125197584 2004-07-29 00:00:00.000 Night
125197584 2004-07-30 00:00:00.000 Night
125197584 2004-07-31 00:00:00.000 Night
125197584 2004-08-01 00:00:00.000 Morning
125197584 2004-08-02 00:00:00.000 Morning
125197584 2004-08-03 00:00:00.000 Morning
125197584 2004-08-04 00:00:00.000 Morning
125197584 2004-08-05 00:00:00.000 Afternoon
125197584 2004-08-06 00:00:00.000 Morning
125197584 2004-08-07 00:00:00.000 Morning
125197584 2004-08-08 00:00:00.000 Morning
125197584 2004-08-09 00:00:00.000 Morning
125197584 2004-08-10 00:00:00.000 Morning
125197584 2004-08-11 00:00:00.000 Morning
125197584 2004-08-12 00:00:00.000 Morning
125197584 2004-08-13 00:00:00.000 Morning
125197584 2004-08-14 00:00:00.000 Morning
125197584 2004-08-15 00:00:00.000 Night
125197584 2004-08-16 00:00:00.000 Night

I need to find all the dates where the shift type has changed.

The only way that I have been able to figure out how to do this is to left join the table on itself , adding 1 day to the date worked in the right hand table and then selecting the differences.

The problem with this is that I may have up to 20 thousand people in the table and the left join is time consuming. The other problem is that the very first record has to be retrieved with a separate select.

Thanks

Regards
Peet Schultz
South Africa

If anybody wants I can mail a script to create the table and data.
GeneralRe: Sequential Dates and Grouping Pin
Michael Potter15-Nov-04 3:33
Michael Potter15-Nov-04 3:33 
GeneralRe: Sequential Dates and Grouping Pin
Peet Schultz15-Nov-04 4:11
Peet Schultz15-Nov-04 4:11 
GeneralRe: Sequential Dates and Grouping Pin
Michael Potter15-Nov-04 8:10
Michael Potter15-Nov-04 8:10 
GeneralGenerate SQL Script ( store procedure problem) Pin
manxx14-Nov-04 8:40
manxx14-Nov-04 8:40 
GeneralView all Tables in database Pin
visitsaadi13-Nov-04 1:33
visitsaadi13-Nov-04 1:33 
GeneralRe: View all Tables in database Pin
Colin Angus Mackay13-Nov-04 1:51
Colin Angus Mackay13-Nov-04 1:51 
QuestionSelect Top 10 from a DataTable ??? Pin
luckyShek12-Nov-04 9:56
luckyShek12-Nov-04 9:56 
GeneralStored Procedures Pin
Anonymous12-Nov-04 6:02
Anonymous12-Nov-04 6:02 
GeneralRe: Stored Procedures Pin
Colin Angus Mackay12-Nov-04 6:41
Colin Angus Mackay12-Nov-04 6:41 
GeneralRe: Stored Procedures Pin
Anonymous14-Nov-04 22:38
Anonymous14-Nov-04 22:38 
QuestionHow to back up database on remote computer?? Pin
venadder12-Nov-04 5:07
venadder12-Nov-04 5:07 
GeneralConnection String for Connection to OLAP Server Pin
mysorian11-Nov-04 16:50
professionalmysorian11-Nov-04 16:50 
GeneralRe: Connection String for Connection to OLAP Server Pin
David Salter11-Nov-04 23:47
David Salter11-Nov-04 23:47 
GeneralFrom a Blob to some type of image in Java Pin
Red Sunday11-Nov-04 9:39
Red Sunday11-Nov-04 9:39 
GeneralInserting Pin
eggie511-Nov-04 8:45
eggie511-Nov-04 8:45 
GeneralRe: Inserting Pin
Colin Angus Mackay11-Nov-04 9:12
Colin Angus Mackay11-Nov-04 9:12 
GeneralRe: Inserting Pin
eggie511-Nov-04 9:15
eggie511-Nov-04 9:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.