Link to home
Start Free TrialLog in
Avatar of Wonderwall
Wonderwall

asked on

Need SQL help

I am trying to write a sql statement perhaps CTE that will find the earliest contact_date or there is a diferrence between the episde dates of greater than six months. Should I do a stored procedure an break it up?    Here's what I have so far. Thanks

;with CTEMembersLBP as
 (SELECT *, row_number() over(partition by Pat_ID order by Pat_ID, contact_date asc) as Dup
FROM dbo.GR_LBP_DX_2010)
Delete from CTEmembersLBP where Dup > 1  
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial