Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 2A621636309 for ; Thu, 11 Mar 2010 03:15:35 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 86088-05-5 for ; Thu, 11 Mar 2010 07:15:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mail.postgresql.org (Postfix) with ESMTP id EF8D06360D4 for ; Thu, 11 Mar 2010 03:15:11 -0400 (AST) Received: by bwz8 with SMTP id 8so5041168bwz.3 for ; Wed, 10 Mar 2010 23:15:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Bj5/Bsi62i/ryiVzVfsi8r9DlhcRuhrOWGw7iun9eTo=; b=cIsszJInOVmnVWBJc5LdAZNH7nqu5igRuDOghwkVe2ROUe/qW8coH0hKb2y6A9p2Ws xHxxvPjvPxJVpzk387aPMUG65PPr8Td+T3EmnCPzB8dkZ451aG2K20hkENN90R6T3xEG yzmZreGb8kQz/7U9dSB7KDdP3Pv4a/AZMFC84= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=fTS4RN9e5OHVoIstx+B6y871tO8VU4Omju2BRn140lm+tLwitRKfD6KSDyPAxiBVW0 8U1EOcEW5hAhpGruDFTWE7ESvsCX/X3dtUosu4XMtY03q1/xeQLaDV1Pm3xiX95fwCEN JV6YINl8Er6NPs46RVJROc57V4551SaddqeiY= MIME-Version: 1.0 Received: by 10.204.32.198 with SMTP id e6mr76558bkd.169.1268291710307; Wed, 10 Mar 2010 23:15:10 -0800 (PST) In-Reply-To: <2a77004c1003102256l24af41e5ueab35874f5320ffa@mail.gmail.com> References: <2a77004c1003102256l24af41e5ueab35874f5320ffa@mail.gmail.com> Date: Thu, 11 Mar 2010 01:15:10 -0600 Message-ID: Subject: Re: How to SELECT From: Dave Crooke To: Angayarkanni Cc: pgsql-performance@postgresql.org Content-Type: multipart/alternative; boundary=00032555e492dd4ce00481812cec X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.338 tagged_above=-10 required=5 tests=AWL=0.260, BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/124 X-Sequence-Number: 37949 --00032555e492dd4ce00481812cec Content-Type: text/plain; charset=ISO-8859-1 Hi there This list is for performance tuning questions related to PostgreSQL ... your question is a general SQL syntax issue. Also, it's not quite clear from your message exactly what you are trying to do - it's better to post example table schemas. At a guess, I think you might want: select 1, * from T1 union all select 2, * from T2 Cheers Dave On Thu, Mar 11, 2010 at 12:56 AM, Angayarkanni wrote: > 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 > > > or when we use > COALESCE(is exits value, or this value) > > i need > say_some_function (if value display,1) > > results should be as > 1 > 1 > 2 > 2 > 1 > 1 > > Is it possible Can any one help me... > > Thanks & Regards > AK > > --00032555e492dd4ce00481812cec Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi there

This list is for performance tuning questions related to Po= stgreSQL ... your question is a general SQL syntax issue. Also, it's no= t quite clear from your message exactly what you are trying to do - it'= s better to post example table schemas.

At a guess, I think you might want:

select 1, * from T1
union= all
select 2, * from T2

Cheers
Dave

On Thu, Mar 11, 2010 at 12:56 AM, Angayarkanni &= lt;kangayarkanni@gmail.com&g= t; wrote:
Hi,

I am the beginner of pgpsql

=A0
I need to sele= ct from two tables say T1,T2 by UNION

when the value is from T1 the output should by a 1 and
when the val= ue from T2 the out put should be 2

when T1 Hits values should be 1 and when T2 hits the value should be 2<= br>

or when we use
COALESCE(is exits=A0 value, or this value)
i need
say_some_function (if value display,1)

results sho= uld be as
1
1
2
2
1
1

Is it possible Can any one help me...
Thanks & Regards
AK


--00032555e492dd4ce00481812cec--