• frecapi (2/14/2011)


    No I didn't think about that. Something like:

    Select ID, apn, (select permit_1 from #mytable), from #mytable union all

    Select ID, apn, (select permit_2 from #mytable), from #mytable....

    Yep... kind of. You need to have something in there so you don't include nulls for permits that don't exist. Then you could also have start and end dates for each permit. Every APN could have 1 to as many permits as you need without worrying about running out of columns.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)