mardi 27 octobre 2015

LIKE clause in PIVOT?

I want to have a LIKE kind of clause in a PIVOT. Right now, I have this:

PIVOT (
    MAX(TAX_AMOUNT) FOR TAX_CODE IN ([TVH], [TVH-ON], [TVH-NB], [TPS], [TVQ])
) PVT

But that is problematic, if new TVH TAX_CODE's are being added (TVH-SK, TVH-QC, etc.), this pivot will stop working.

I tried [%TVH%] but that's a syntax error.

Any ideas ?

Aucun commentaire:

Enregistrer un commentaire