Pablo Braulio escribió:
> Estoy probando con esto:
>
> select case when tipo is null then 0 end as tipo from estudios;
>
> Pero si no es nulo no me devuelve nada.
>
> tipo
> - ------
>
> (1 fila)
Obvio, porque no pusiste que hacer en caso de que no sea nulo. Le falta
un ELSE a tu case, algo asi:
select case when tipo is null then 0 else tipo end as tipo from estudios;
Pero en realidad es mas breve y facil de leer hacerlo con COALESCE:
select coalesce(tipo, 0) from estudios
--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"Digital and video cameras have this adjustment and film cameras don't for the
same reason dogs and cats lick themselves: because they can." (Ken Rockwell)