pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Louise Catherine <r1c4n@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: about subselect
Date: Fri, 12 Aug 2005 00:03:26 -0400
Message-ID: <25508.1123819406@sss.pgh.pa.us> (raw)
In-Reply-To: <20050812033830.80532.qmail@web33414.mail.mud.yahoo.com>
References: <20050812033830.80532.qmail@web33414.mail.mud.yahoo.com>

Louise Catherine <r1c4n@yahoo.com> writes:
> I make a subquery test at postgresql
> 7.3.3 and postgresql 8.0.3.
> I found that postgresql 8.0.3 can't do this,
> while at postgresql 7.0.3 it works quite well :

7.3 says this:
NOTICE:  Adding missing FROM-clause entry in subquery for table "temp_hasil2"

which means that the query is invalid according to the SQL spec.  Later
versions are just being tougher about enforcing the spec.  If you are
happy with 7.3's interpretation of what the query means, try adding

> Update Temp_hasil2 Set KdPT = A.PTCD,
> KdLjr = A.LKRJACD
> From (Select A38.NIK,A01.ptcd,A38.Lkrjacd
>       From AM382 A38
>            inner join
>            ap012 A01 on A38.nojob = A01.nojob
>       Where A38.tglavd =
>             (select max(B38.tglavd) from am382 B38, Temp_hasil2
                                                    ^^^^^^^^^^^^^
>             where A38.nik = B38.nik
>             and B38.tglavd <= Temp_hasil2.Tanggal)
>             And A01.tglavd =
>             (select max(B01.tglavd) from ap012 B01
>             where A01.nojob = B01.nojob
>             and B01.tglavd <= A38.tglavd)
>      )A
> Where Temp_hasil2.NIK = A.NIK;

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <25508.1123819406@sss.pgh.pa.us>
Permalink:  ../25508.1123819406@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25508.1123819406@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, r1c4n@yahoo.com
  Subject: Re: about subselect
  In-Reply-To: <25508.1123819406@sss.pgh.pa.us>

* 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