select and as doubt

From: Alexandre Gonçalves Jacarandá <clark_vr(at)yahoo(dot)com(dot)br>
To: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: select and as doubt
Date: 2006-01-15 03:55:33
Message-ID: 43C9C7B5.5070707@yahoo.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-01-15 04:28:50 Re: select and as doubt
Previous Message Michael Glaesemann 2006-01-14 22:38:39 Re: psql client: technique for applying default values to :variables?