I have a table where we write part test info from robots. I'm trying to get a list of tool changes within last 5 days.
Below a simplified version of my table. I would like to know when PART_NO column changes from 23147446 to 23147423 or vise versa. and when it does, start and the end time of both records, which gives me the downtime. I tried MIN and MAX, But only worked to get last tool change not a list.
Further note: Im using SQL Server 2000, This table also contains several other values in PART_NO that I don't care about.Any help is appreciated, as im completely stuck now. Thanks !
Ideal results would be:
23147446 09/12 12:24:43 to 09/12 12:25:13
23147423 09/12 00:57:39- 09/12 01:03:19and goes on for last 5 days
SERL_TS PART_NO
2013-09-12 12:33:42.000 23147446
2013-09-12 12:32:25.000 23147446
2013-09-12 12:30:36.000 23147446
2013-09-12 12:29:15.000 23147446
2013-09-12 12:28:06.000 23147446
2013-09-12 12:27:13.000 23147446
2013-09-12 12:26:13.000 23147446
2013-09-12 12:24:43.000 23147423
2013-09-12 12:23:10.000 23147423
2013-09-12 12:21:22.000 23147423
2013-09-12 12:20:26.000 23147423
2013-09-12 12:19:29.000 23147423
2013-09-12 12:18:32.000 23147423
2013-09-12 12:17:25.000 23147423
2013-09-12 12:16:30.000 23147423
2013-09-12 12:15:24.000 23147423
2013-09-12 12:14:29.000 23147423
2013-09-12 12:13:34.000 23147423
2013-09-12 01:09:39.000 23147458
2013-09-12 01:08:47.000 23147458
2013-09-12 01:08:02.000 23147458
2013-09-12 01:06:44.000 23147458
2013-09-12 01:05:42.000 23147423
2013-09-12 01:04:08.000 23147423
2013-09-12 01:03:19.000 23147423
2013-09-12 01:02:38.000 23147458
2013-09-12 01:01:30.000 23147458
2013-09-12 01:00:13.000 23147453
2013-09-12 00:59:25.000 23147453
2013-09-12 00:58:31.000 23147453
2013-09-12 00:57:39.000 23147446
2013-09-12 00:56:55.000 23147446
2013-09-12 00:55:45.000 23147453