pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
select and as doubt
4+ messages / 3 participants
[nested] [flat]

* select and as doubt
@ 2006-01-15 03:55  Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>
  0 siblings, 1 reply; 4+ messages in thread

From: Alexandre Gonçalves Jacarandá @ 2006-01-15 03:55 UTC (permalink / raw)
  To: 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 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: select and as doubt
@ 2006-01-15 04:28  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2006-01-15 04:28 UTC (permalink / raw)
  To: Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>; +Cc: pgsql-sql

=?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= <clark_vr@yahoo.com.br> 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: select and as doubt
@ 2006-01-15 14:59  Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Alexandre Gonçalves Jacarandá @ 2006-01-15 14:59 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

Thanks for reply Tom, but which docs should I read for that ?

Tom Lane escreveu:
> =?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= <clark_vr@yahoo.com.br> 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 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: select and as doubt
@ 2006-01-23 16:44  Bruno Wolff III <bruno@wolff.to>
  parent: Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>
  0 siblings, 0 replies; 4+ messages in thread

From: Bruno Wolff III @ 2006-01-23 16:44 UTC (permalink / raw)
  To: Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql

On Sun, Jan 15, 2006 at 12:59:48 -0200,
  Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br> 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:
> > =?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= <clark_vr@yahoo.com.br> 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-01-23 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-15 03:55 select and as doubt Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>
2006-01-15 04:28 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-01-15 14:59   ` Alexandre Gonçalves Jacarandá <clark_vr@yahoo.com.br>
2006-01-23 16:44     ` Bruno Wolff III <bruno@wolff.to>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox