I am trying to delete the first 3 records in a table but am at a loss as how to do it.
Table looks like this...
create table #classCuts (
lastname varchar(50),
firstname varchar(50),
studentnumber varchar(15),
coursenumber varchar(13),
sectionnumber int,
coursename varchar(30),
periodname varchar(10),
teacherdisplay varchar(30),
cutdate smalldatetime
If a student cuts a class more than 3 times, I want to remove the first 3 records, yet keep the other records so teachers can write a referral. Data would look like this in the table..
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 10/28/2009
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 11/4/2009
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 11/13/2009
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 11/17/2009
The end result will leave only 1 record in the table. The first 3 deleted.
I tried a cursor to do this but am stuck with the syntax.
Table looks like this...
create table #classCuts (
lastname varchar(50),
firstname varchar(50),
studentnumber varchar(15),
coursenumber varchar(13),
sectionnumber int,
coursename varchar(30),
periodname varchar(10),
teacherdisplay varchar(30),
cutdate smalldatetime
If a student cuts a class more than 3 times, I want to remove the first 3 records, yet keep the other records so teachers can write a referral. Data would look like this in the table..
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 10/28/2009
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 11/4/2009
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 11/13/2009
xxx Joseph 6519 103 10 ENGLISH 10 8 Mr. Teacher 11/17/2009
The end result will leave only 1 record in the table. The first 3 deleted.
I tried a cursor to do this but am stuck with the syntax.