troubleshooting Question

TSQL delete

Avatar of gvamsimba
gvamsimbaFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft SQL Server 2005SQL
5 Comments1 Solution243 ViewsLast Modified:
HI, I have a table with the below structure.. now i want
to delete all those id's where the stock_codes are similar
within last two months from the min(date).. for instance the below id shall
be deleted as it has the same stock_code within 2 months..

ID               Date                                       stock_id
                              
4942129      2007-12-26 00:00:00.000      ANIKOCM205117830
4942129      2008-01-27 00:00:00.000      ANIKOCM205117830

can anybody please give me that sql code please ?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros