|
Archives of the TeradataForumMessage Posted: Mon, 17 Dec 2012 @ 14:05:53 GMT
Excellent Dave!! Your query works perfect however I require this delete script on mload so I proceed with below subquery as I cannot create a volatile table. DELETE FROM TABLE WHERE cal_dt < ( SELECT MIN(a.cal_dt) FROM ( SELECT TOP 4 cal_dt FROM TABLE GROUP BY cal_dt ORDER BY cal_dt DESC) a ); Above query holds exactly last four weeks of data. Thanks a lot for your help!! Regards, John
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||