pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
help with troublesome query
2+ messages / 2 participants
[nested] [flat]

* help with troublesome query
@ 2003-07-15 13:26  teknokrat <teknokrat@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: teknokrat @ 2003-07-15 13:26 UTC (permalink / raw)
  To: pgsql-sql

I have three tables customers which 1-many with requests which is 1-1 
with applications. all customers have at least one request but not all 
requests have an application.

I want a query to return all the customers and their application data if 
they have any ( or else null). So this is like a left join of customers 
  with applications but I do not want multiple rows of customers UNLESS 
they have an application.

thanks





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: help with troublesome query
@ 2003-07-15 13:47  Bruno Wolff III <bruno@wolff.to>
  parent: teknokrat <teknokrat@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2003-07-15 13:47 UTC (permalink / raw)
  To: teknokrat <teknokrat@yahoo.com>; +Cc: pgsql-sql

On Tue, Jul 15, 2003 at 14:26:16 +0100,
  teknokrat <teknokrat@yahoo.com> wrote:
> I have three tables customers which 1-many with requests which is 1-1 
> with applications. all customers have at least one request but not all 
> requests have an application.
> 
> I want a query to return all the customers and their application data if 
> they have any ( or else null). So this is like a left join of customers 
>  with applications but I do not want multiple rows of customers UNLESS 
> they have an application.

I think you want to first do an inner join of requests and applications
and then left join the customers and the previous join.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-07-15 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-15 13:26 help with troublesome query teknokrat <teknokrat@yahoo.com>
2003-07-15 13:47 ` Bruno Wolff III <bruno@wolff.to>

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