From: | Jayadevan M <Jayadevan(dot)Maymala(at)ibsplc(dot)com> |
---|---|
To: | Thomas BOURIMECH <thomas(dot)bourimech(at)metnext(dot)com> |
Cc: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>, pgsql-sql-owner(at)postgresql(dot)org |
Subject: | Re: LEFT OUTER JOIN issue |
Date: | 2010-04-22 03:41:56 |
Message-ID: | OF94932B74.C13D8741-ON6525770D.00141E18-6525770D.001445D5@ibsplc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
> SELECT ct.dat,ct.heur,hp.datmesure,hp.heuremesure,hp.t FROM
calendar_temp as ct
> LEFT OUTER JOIN h_part as hp
> ON ct.dat = hp.datmesure
> AND ct.heur = hp.heuremesure
> WHERE
> hp.poste_idposte = 275
> ORDER BY ct.dat, ct.heur
> dat heur datmesure heuremesure t
> -----------------------------------------------------------
> 15/03/2008 0:00 15/03/2008 0:00 8,3
> 15/03/2008 3:00 15/03/2008 3:00 12
> 15/03/2008 6:00 15/03/2008 6:00 15
> 15/03/2008 9:00 15/03/2008 9:00 18
> 15/03/2008 12:00 null null null
> 15/03/2008 15:00 null null null
Would this work?
SELECT ct.dat,ct.heur,hp.datmesure,hp.heuremesure,hp.t FROM calendar_temp
as ct
LEFT OUTER JOIN h_part as hp
ON ct.dat = hp.datmesure
AND ct.heur = hp.heuremesure
WHERE
coalesce(hp.poste_idposte,275) = 275
ORDER BY ct.dat, ct.heur
dat | heur | datmesure | heuremesure | t
------------+----------+------------+-------------+------
2008-03-15 | 00:00:00 | 2008-03-15 | 00:00:00 | 8.3
2008-03-15 | 03:00:00 | 2008-03-15 | 03:00:00 | 12.0
2008-03-15 | 06:00:00 | 2008-03-15 | 06:00:00 | 15.0
2008-03-15 | 09:00:00 | 2008-03-15 | 09:00:00 | 18.0
2008-03-15 | 12:00:00 | | |
2008-03-15 | 15:00:00 | | |
(6 rows)
Regards,
Jayadevan
DISCLAIMER:
"The information in this e-mail and any attachment is intended only for
the person to whom it is addressed and may contain confidential and/or
privileged material. If you have received this e-mail in error, kindly
contact the sender and destroy all copies of the original communication.
IBS makes no warranty, express or implied, nor guarantees the accuracy,
adequacy or completeness of the information contained in this email or any
attachment and is not liable for any errors, defects, omissions, viruses
or for resultant loss or damage, if any, direct or indirect."
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas BOURIMECH | 2010-04-22 07:54:27 | Re: LEFT OUTER JOIN issue [SOLVED] |
Previous Message | Gonzalo Aguilar Delgado | 2010-04-21 17:36:54 | Re: Problem with insert related to different schemas |