How to compare database using sql ?
Are you looking for a way to compare database columns using sql ? then read this thread to know how to compare it
I am dealing with a large database which looks like following-
Empid policyid startdate enddate
120 A120 07/01/2010 06/30/2011
120 A121 07/01/2011 06/30/2012
121 B119 07/01/2014 06/30/2015
122 A125 07/01/2012 06/30/2013
122 A126 07/01/2013 06/30/2014
122 A127 06/01/2014 06/30/2015
My requirement is, i need to check for each employee that is there any policy for which start date of any policy is prior to the end date of earlier policy. Like dual coverage at the same time.
Can anyone help here as how to write query for this condition.