Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0084A6360D4 for ; Thu, 11 Mar 2010 03:14:31 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 15449-04 for ; Thu, 11 Mar 2010 07:14:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mail.postgresql.org (Postfix) with ESMTP id 523FA635FA8 for ; Thu, 11 Mar 2010 03:14:20 -0400 (AST) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0LmgXX-1NH7Bx1dzf-00a7Me; Thu, 11 Mar 2010 08:14:18 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1Npcb3-0001ro-00 for pgsql-performance@postgresql.org; Thu, 11 Mar 2010 08:14:17 +0100 Date: Thu, 11 Mar 2010 08:14:17 +0100 From: "A. Kretschmer" To: pgsql-performance@postgresql.org Subject: Re: How to SELECT Message-ID: <20100311071417.GB1035@a-kretschmer.de> References: <2a77004c1003102256l24af41e5ueab35874f5320ffa@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2a77004c1003102256l24af41e5ueab35874f5320ffa@mail.gmail.com> X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX18gpAmm4Jka/pqzdrMAAT/Sa90K6+iwqcQoUBT mhIhtKRpQfqXrO/8xTq5+4247RgCtht5kYBIuf0lzLTSaLaGQv PXDofmxks3ccuey3u+gMA== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.185 tagged_above=-10 required=5 tests=BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 201003/123 X-Sequence-Number: 37948 In response to Angayarkanni : > Hi, > > I am the beginner of pgpsql > >   > I need to select from two tables say T1,T2 by UNION > > when the value is from T1 the output should by a 1 and > when the value from T2 the out put should be 2 > > when T1 Hits values should be 1 and when T2 hits the value should be 2 select 'table 1' as table, * from t1 union all select 'table 2', * from t2; Regards, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99