pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Abhishek <ajcool@gmail.com>
To: boinger <boinger@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: combining records from a single table and presenting them as one record
Date: Fri, 28 Oct 2005 11:47:12 -0400
Message-ID: <506ca6630510280847m2a875f05y4897cce58e4adf8e@mail.gmail.com> (raw)
In-Reply-To: <9e6d8b530510271446w63c1eb8dp97e7703dde3309a4@mail.gmail.com>
References: <506ca6630510271100y367e1fb2hfb05f5ecaae043a3@mail.gmail.com>
	<9e6d8b530510271446w63c1eb8dp97e7703dde3309a4@mail.gmail.com>

Using LIMIT 1 does return me a single record but please note that the table
can have multiple guids for which I need a unique record with all the digit
types combined. Using LIMIT 1 returns me always one record. :-(

On 10/27/05, boinger <boinger@gmail.com> wrote:
>
> On 10/27/05, Abhishek <ajcool@gmail.com> wrote:
> > I am tryng to write a query which returns me a record like this
> <snip>
> > I do the query as this:
> >
> > select callguid , ( select digits from TABEL1 where type='a' ), ( select
> > digits from TABEL1 where type='b' ), ( select digits from TABEL1 where
> > type='c' ) from TABLE1;
> <snip>
> > Note that I get the records which i wanted, but I get them duplicated.
> If I
> > use 'distinct' keyword I get the desired result with no duplication. But
> > 'distinct' seems to be too expensive.
> >
> > Is there any better way I can do this without compromising the
> performance ?
>
> Just add 'LIMIT 1' to the end of the query.
>



--
Abhishek Jain

view thread (5+ messages)  latest in thread

Message-ID: <506ca6630510280847m2a875f05y4897cce58e4adf8e@mail.gmail.com>
Permalink:  ../506ca6630510280847m2a875f05y4897cce58e4adf8e@mail.gmail.com/
Also on:    postgresql.org/message-id/506ca6630510280847m2a875f05y4897cce58e4adf8e@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ajcool@gmail.com, boinger@gmail.com
  Subject: Re: combining records from a single table and presenting them as one record
  In-Reply-To: <506ca6630510280847m2a875f05y4897cce58e4adf8e@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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