Never mind, I'm an idiot. The AS gps_p needs to move outside the inner SELECT.

Carlos

On 12/22/2010 11:19 AM, Carlos Konstanski wrote:
> I have a postgresql problem. Trying to alias a column with the name gps_p,
> but the AS isn't having any effect. The contents of the column are a
> calculation in a CASE statement. When I get my result set, the column is
> called ?column?. See the CASE statement in the query below. Any ideas on why
> this isn't working? Using postgresql 9.0.1.
> 
> Thanks,
> 
> Carlos
> 
> create or replace view categories_gps as
> select c.id as id,
>   c.parent_id as parent_id,
>   c.name as name,
>   c.menu_p as menu_p,
>   c.start_date as start_date,
>   c.end_date as end_date,
>   c.createdby as createdby,
>   (select
>     (case
>       when sum(l.latcoord) + sum(l.longcoord) is null then false
>       else true
>     end) as gps_p
>     from locations l
>     where l.id in (select cl.business_id
>                   from category_lookup cl
>                   where cl.category_id = c.id))
> from categories c;
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to