select and as doubt

Поиск
Список
Период
Сортировка
Искать

select and as doubt

От:
Alexandre Gonçalves Jacarandá<clark_vr@yahoo.com.br>
Дата:
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 


Re: select and as doubt

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Alexandre Gonçalves Jacarandá  writes:
> It's possible to make an SELECT inside an AS clause ?

No.  You could try building the query as a string.
		regards, tom lane

Re: select and as doubt

От:
Alexandre Gonçalves Jacarandá<clark_vr@yahoo.com.br>
Дата:
Thanks for reply Tom, but which docs should I read for that ?

Tom Lane escreveu:
> Alexandre Gonçalves Jacarandá  writes:
> 
>>It's possible to make an SELECT inside an AS clause ?
> 
> 
> No.  You could try building the query as a string.
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
> 


-- 
__________________________
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 


Re: select and as doubt

От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Sun, Jan 15, 2006 at 12:59:48 -0200, Alexandre Gonçalves Jacarandá  wrote:
> Thanks for reply Tom, but which docs should I read for that ?

The documentation for whatever ever programming language you will be using
to generate the queries.

> 
> Tom Lane escreveu:
> > Alexandre Gonçalves Jacarandá  writes:
> > 
> >>It's possible to make an SELECT inside an AS clause ?
> > 
> > 
> > No.  You could try building the query as a string.
> > 
> > 			regards, tom lane
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> > 
> 
> 
> -- 
> __________________________
> 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 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq

FAQ