pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to SELECT
4+ messages / 3 participants
[nested] [flat]
* How to SELECT
@ 2010-03-11 06:56 Angayarkanni <kangayarkanni@gmail.com>
0 siblings, 2 replies; 4+ messages in thread
From: Angayarkanni @ 2010-03-11 06:56 UTC (permalink / raw)
To: pgsql-performance
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to SELECT
@ 2010-03-11 07:14 A. Kretschmer <andreas.kretschmer@schollglas.com>
parent: Angayarkanni <kangayarkanni@gmail.com>
1 sibling, 1 reply; 4+ messages in thread
From: A. Kretschmer @ 2010-03-11 07:14 UTC (permalink / raw)
To: pgsql-performance
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to SELECT
@ 2010-03-11 07:15 Dave Crooke <dcrooke@gmail.com>
parent: Angayarkanni <kangayarkanni@gmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: Dave Crooke @ 2010-03-11 07:15 UTC (permalink / raw)
To: Angayarkanni <kangayarkanni@gmail.com>; +Cc: pgsql-performance
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 <kangayarkanni@gmail.com>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
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to SELECT
@ 2010-03-11 07:23 Angayarkanni <kangayarkanni@gmail.com>
parent: A. Kretschmer <andreas.kretschmer@schollglas.com>
0 siblings, 0 replies; 4+ messages in thread
From: Angayarkanni @ 2010-03-11 07:23 UTC (permalink / raw)
To: A. Kretschmer <andreas.kretschmer@schollglas.com>; +Cc: pgsql-performance
Yes I got Yaar
Thanks a lot !!! (Dave Crooke,A. Kretschmer )
Regards,
Angayarkanni Kajendran
On Thu, Mar 11, 2010 at 12:44 PM, A. Kretschmer <
andreas.kretschmer@schollglas.com> wrote:
> 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
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2010-03-11 07:23 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-03-11 06:56 How to SELECT Angayarkanni <kangayarkanni@gmail.com>
2010-03-11 07:14 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-03-11 07:23 ` Angayarkanni <kangayarkanni@gmail.com>
2010-03-11 07:15 ` Dave Crooke <dcrooke@gmail.com>
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