Thanks again - That was my first thought, and i tried it with no succes.
It don't work, because the problem ain't that SubGroupType is <Null>, but that it don't exist, making substat <NULL>.
On all the other subcalls there is an answer - This one is different, as it can have no answer.
What i should have was a line
IF substat = <NULL> then SUBSTAT = 0 END
Which is the purpose of ISNULL, but it needs a db field as source - I really think I am stuck here.
OK, I can read the result of the query in a queue, and handle it from there - Its max 100 records.
Best regards
Edvard Korsbæk