X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 021589DC848 for ; Sun, 15 Jan 2006 00:03:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14495-08 for ; Sun, 15 Jan 2006 00:02:59 -0400 (AST) X-Greylist: delayed 00:06:39.625924 by SQLgrey- Received: from smtp200.mail.sc5.yahoo.com (smtp200.mail.sc5.yahoo.com [216.136.130.125]) by postgresql.org (Postfix) with SMTP id 613289DC82B for ; Sun, 15 Jan 2006 00:02:59 -0400 (AST) Received: (qmail 78850 invoked from network); 15 Jan 2006 03:56:18 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=bZOTEjllkfnpazo3MDRa2OwD91PxbznBxtFstFz9LfWc8P9Zk9E0CHOItWng0k6tfmIMv4H6rS+KZgFvv6RQ/oqSLis+4X5UFkyx5i8ouarKWbLARY7F8eo9ZrMx6Vqm0f4nmXs8p+WQLySSUs7gIXDR3L9uMjDOzoro1LpYFFE= ; Received: from unknown (HELO ?200.165.209.168?) (clark?vr@200.165.209.168 with plain) by smtp200.mail.sc5.yahoo.com with SMTP; 15 Jan 2006 03:56:17 -0000 Message-ID: <43C9C7B5.5070707@yahoo.com.br> Date: Sun, 15 Jan 2006 01:55:33 -0200 From: =?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= User-Agent: Mozilla Thunderbird 1.0.6-7.2.20060mdk (X11/20050322) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: pgsql Subject: select and as doubt Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.806 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 0.806 X-Spam-Level: X-Archive-Number: 200601/74 X-Sequence-Number: 23863 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