| From: | Oleg Broytmann <phd(at)sun(dot)med(dot)ru> |
|---|---|
| To: | "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
| Subject: | RE: [HACKERS] Bug on complex subselect (was: Bug on complex join) |
| Date: | 1999-03-11 12:48:12 |
| Message-ID: | Pine.SOL2.3.96.SK.990311154612.15683A-100000@sun.med.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-sql |
Hello!
Vadim already gave the idea to use EXISTS. Will try it.
Thanks to all who replied!
On Wed, 10 Mar 1999, Jackson, DeJuan wrote:
> Try your query this way:
> SELECT DISTINCT subsec_id
> FROM positions p
> WHERE EXISTS(SELECT 1
> FROM central c, shops s, districts d
> WHERE p.pos_id = c.pos_id AND
> c.shop_id = s.shop_id AND
> s.distr_id = d.distr_id AND
> d.city_id = 2);
> Make sure you have indexes on pos_id, shop_id, distr_id, and city_id.
All these are primary keys in corresponding tables, and hence have
UNIQUE indicies. Is it enough?
Oleg.
----
Oleg Broytmann http://members.xoom.com/phd2/ phd2(at)earthling(dot)net
Programmers don't die, they just GOSUB without RETURN.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stefan Wehner | 1999-03-11 13:22:12 | Bug with sequences in 6.4.2 |
| Previous Message | Tatsuo Ishii | 1999-03-11 10:29:20 | [CURRENT] NetBSD/macppc porting patch |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Herouth Maoz | 1999-03-11 14:22:48 | Re: SQL92 standard conformance [was Re: [SQL] OUTER JOINS in 6.4.2?? Work around?? |
| Previous Message | Ulf Mehlig | 1999-03-11 08:45:45 | Re: [SQL] How match percent sign in SELECT using LIKE? |