1

SQL structure

id, startdate, enddate  
1, 2012-01-01, 2012-10-01  

I need sql statment to receive duplicate rows from startdate to enddate range.

Example result would be:

1, 2012-01-01
1, 2012-02-01
1, 2012-03-01
...
1, 2012-10-01  

Does anyone have an idea how to solve this???

  • what do you need? Add some realistic data to example !! – manurajhada Jul 20 '12 at 11:54
  • Well I have events table where some events last multiple days. I need to get a record for every single day on which these events are taking place on along with events that last only one day. – user1540633 Jul 20 '12 at 12:03

1 Answers1

0

It should be something like this :

SELECT
  id, startdate, enddate
FROM
  myTable
WHERE
  (startdate, enddate) IN 
  (
    SELECT
      startdate, enddate
    FROM
       myTable
    GROUP BY
      startdate, enddate
    HAVING
      COUNT(*) > 1     
  )
psadac
  • 2,312
  • 5
  • 32
  • 41