Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delete
- from
- MyTable
- where
- item_id in
- (
- select
- item_id
- from
- MyTable
- group by
- item_id
- having
- count(item_id) > 15
- )
- and
- Date < @tDate
- DELETE
- FROM CommentTable
- WHERE CommentId NOT IN (
- SELECT TOP 15 CommentId
- FROM CommentTable
- WHERE ItemId=@ItemId
- AND CommentDate < @Date
- ORDER BY CommentDate DESC
- )
- AND ItemId=@ItemId
- AND CommentDate < @Date
- DELETE
- [MyTable]
- WHERE
- [item_id] = 100 and
- (SELECT COUNT(*) FROM [MyTable] WHERE [item_id] = 100) > 15
Add Comment
Please, Sign In to add comment