From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | josep porres <jmporres(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: wrong query result |
Date: | 2008-04-09 08:32:51 |
Message-ID: | 47FC7F33.4040405@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
josep porres wrote:
> select clau, lecact-lecant as m3, m3any, ta, tc, 3 as mesos, persones, true
> as clavegueram
> from fac_abonats
> where clau in (select clau from tmp_claus_prova)
> order by clau
> At the end I've realized that there is no column named 'clau'. It has
> another name.
> The question is:
> Is it a normal behaviour? Because I think that if the query is wrong,
> wouldn't be better to raise an error?
It's not an error, you need to be able to refer to columns in the outer
query so you can do:
...(SELECT x FROM tmp_claus_prova WHERE y = clau)
It *is* confusing where you have a typo though. It gets everyone from
time to time.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2008-04-09 08:39:06 | Re: wrong query result |
Previous Message | josep porres | 2008-04-09 08:20:18 | wrong query result |