• Not on the original topic, but relevant: The day I discovered I could Merge into a CTE, and thus limit the target rows with whatever Where clause I felt like, was a very good day.

    CTEs, used appropriately, are a great way to simplify otherwise complex data manipulation tasks.

    - 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