Hi,MSSQL 2005 This CTE and following Delete, deletes 1000 blobsfrom every categoryWITH tempdata AS (SELECT ItsAKeeper, ROW_NUMBER() OVER (PARTITION BY Category ORDER BY Age DESC) AS rownum, ID FROM Imageblob WHERE ItsAKeeper = 'False')DELETE FROM tempdata WHERE rownum > 1000;
But what I want to do is delete 1000 from the category with mostrows and 500 from the second biggest. Not shure how to do it though.Select count(Age)From imageblobsGroup by Catebogry
that gives me each row per category but I want to use it with the first CTE.Any suggestions/code/help/hints are much appritiated´My t-sql knowledge is rubbishCheers,/Andreas