Re: Can't put sub-queries values in queries results?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Manuel Lemos <mlemos(at)acm(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Can't put sub-queries values in queries results?
Date: 2000-07-22 17:50:21
Message-ID: Pine.BSF.4.10.10007221044360.88983-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


What version are you using?
Current sources allow this, and 7.0.2 should as well.

sszabo=# select * from a;
a
---
3
4


(4 rows)

sszabo=# select * from b;
a
---
3
4
3
3
(4 rows)

sszabo=# select distinct a, (select count(*) from b where b.a=a.a) from a;
a | ?column?
---+----------
3 | 3
4 | 1
| 0
(3 rows)

Stephan Szabo
sszabo(at)bigpanda(dot)com

On 21 Jul 2000, Manuel Lemos wrote:
> SELECT f1, (SELECT COUNT(*) FROM t2 WHERE t2.f2=t1.f1) AS my_count FROM t1

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Manuel Lemos 2000-07-22 20:13:08 Re: Can't put sub-queries values in queries results?
Previous Message Manuel Lemos 2000-07-22 16:02:19 RE: Can't put sub-queries values in queries results?