• laurie-789651 (8/28/2012)


    GSquared (8/28/2012)


    CptCrusty1 (8/28/2012)


    Laurie,

    Thanks for your reply. The "Values" reserved word didn't fly in 2005. Is that a 2008+ term?

    Thanks

    Crusty

    That's what's called a "Table Values Function", and it's 2008+. It will also only work with data that's limited to no more than 9 values per set.

    Just for the record, this example is limited to 9, but you can code the numbers table up to any number.

    Yes, but it will still have a finite limit, and is an unnecessary limit on the query. This kind of situation is exactly what Full Outer Join is meant for, so working around it with hard-coded things like that is unnecessary.

    The numbers table version you came up with isn't a bad solution, it's just unnecessarily complex for the desired end result. That's all. No big deal. And a hard-coded numbers table with a few thousand rows would be backwards compatible, and work for any conceivable data complexity needed by this code. So it's limits aren't that big a deal. Just an Occam fan here.

    - 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