select and as doubt - Mailing list pgsql-sql

From Alexandre Gonçalves Jacarandá
Subject select and as doubt
Date
Msg-id 43C9C7B5.5070707@yahoo.com.br
Whole thread Raw
Responses Re: select and as doubt  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hello folks!!!
I've a question that could be very strange:
It's possible to make an SELECT inside an AS clause ?

ex.:
select student_id, subject_name_id, grade as (select subject_name from
subject_names) from grades;

The wy is that i've a table with subject names and another with name_id
and grades like:
Table subject_names ( id, subject_name);
Table students ( id, name);
Table grades ( student_id, subject_name_id, grade)

My goal is display an report that have this layout:

Name    | Math | Bio |  English
Joe Doe | 10   | 8   |  6
Mary    | 8    | 6   |  5

I try to make this with crosstab, but I need that columns with suject
grades are displayed automaticlly

Thanks.

-- 
__________________________
Alguns caminham pelo arco,
eu caminho pela reta.

Alexandre Gonçalves Jacarandá
Assessor de Tecnologia de Informação
Tel.: 0 ** 21 8131-2313

    
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 



pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: psql client: technique for applying default values to :variables?
Next
From: Tom Lane
Date:
Subject: Re: select and as doubt