• Is this something where you can provide the table create scripts and some insert statements for sample data? Ideally, also include the desired output.

    I can see a few things that could probably be improved in the query, but I can't test anything on it.

    One question that comes to mind immediately is why have all those string functions on the dates and times? All the April dates, I mean.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon