> What I need > to do is limit the info to the most recent 20 or 30 procedures for any > particular doctor and delete the rest. Some have less than 20 procedures, > some have hundreds.
Firstly, you can get the records you need as follows: CREATE VIEW HistView AS + SELECT * FROM HistTable + ORDER BY DateColumn DESC SELECT * FROM HistView + WHERE DoctorID = .vDoctorID + AND ProcedureID = .vProcedureID + AND LIMIT = 30 Now, if you want to actually build a new table with only the most recent information you want to do something like this: DECLARE crsProcs CURSOR FOR + SELECT DISTINCT DoctorID, ProcedureID FROM HistTable Then loop on this cursor and taking the records described by the above SELECT statement and INSERTing them into the new table. -- Larry. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l
