Re: [SQL] How to max() make null as biggest value?

2010-04-21 Thread silly sad
On 04/14/10 08:33, Feixiong Li wrote: Hi , guys , I am newbie for sql, I have a problem when using max() function, I need get null when there are null in the value list, or return the largest value as usual, who can do this? i.e. max([1,2,3,4,5]) = 5 max([1,2,3,4,5,null]) = null if u want a

[SQL] LEFT OUTER JOIN issue

2010-04-21 Thread Thomas BOURIMECH
Hi everyone, here is my problem : I got two tables : CREATE TABLE public.calendar_temp ( id SERIAL, dat DATE, heur TIME WITHOUT TIME ZONE, CONSTRAINT calendar_temp_pkey PRIMARY KEY(id) ) WITHOUT OIDS; CREATE TABLE public.h_part ( idh SERIAL, poste_idposte INTEGER NOT NULL, t

Re: [SQL] LEFT OUTER JOIN issue

2010-04-21 Thread Oliveiros
Hi, Thomas. I believe it is because of your WHERE clause, which is filtering out the nulls from hp table. According to WHERE hp.poste_idposte = 275 You only want registers that have hp.poste_idposte = 275, not the null ones. HTH Best, Oliveiros - Original Message -

Re: [SQL] Problem with insert related to different schemas

2010-04-21 Thread Scott Marlowe
On Wed, Apr 21, 2010 at 7:25 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Tom, This is a select query.  I don't think that's the right error message. Yes, but IS the correct error message. The query being complained of appears to be a generated foreign key checking

Re: [SQL] Problem with insert related to different schemas

2010-04-21 Thread Tom Lane
Scott Marlowe scott.marl...@gmail.com writes: On Wed, Apr 21, 2010 at 7:25 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Maybe but I ran even grant all on schema public for this user to check if this was the problem. That doesn't do what you think it does. You need to grant

Re: [SQL] LEFT OUTER JOIN issue

2010-04-21 Thread Harald Fuchs
In article 987929295d1345b5bce249f42730c...@marktestcr.marktest.pt, Oliveiros oliveiros.crist...@marktest.pt writes: Hi, Thomas. I believe it is because of your WHERE clause, which is filtering out the nulls from hp table. According to WHERE hp.poste_idposte = 275 You only want

Re: [SQL] Problem with insert related to different schemas

2010-04-21 Thread Gonzalo Aguilar Delgado
Hi Tom, This may be a clue... Will check El mié, 21-04-2010 a las 11:23 -0400, Tom Lane escribió: Scott Marlowe scott.marl...@gmail.com writes: On Wed, Apr 21, 2010 at 7:25 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Maybe but I ran even grant all on schema public for

Re: [SQL] LEFT OUTER JOIN issue

2010-04-21 Thread Jayadevan M
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