for following SQL

select
 ( select case when (a.mdz is null) then 'A'
                when (cast(a.mdz as timestamp) > cast('2011-09-30' as 
timestamp)) then 'B'
                when (cast(a.mdz as timestamp) < cast('2011-09-30' as 
timestamp)) then 'C'
                else 'D'

                end

                from (
                   select  max(KEStazZap.stazzapdatumzaposljavanja) as mdz
                   from KEStazZap
                    where KEStazZap.DjelatnikID = KEDjelatnik.DjelatnikID
                      and cast( '2011-09-30'  as timestamp) <=  
cast(KEStazZap.stazzapdatumprekida as timestamp)
                    group by djelatnikID
                    ) a
)

from
KEDjelatnik



in results I get Null values where I think it should be 'A'. What am I doing 
wrong ?


Regards,
Zlatko

Reply via email to