Re: rewrite in to exists?
| От | Manfred Koizar |
|---|---|
| Тема | Re: rewrite in to exists? |
| Дата | |
| Msg-id | 6eglmvc6h739mvth5qjueqsv9363n2c494@email.aon.at обсуждение исходный текст |
| Ответ на | Re: rewrite in to exists? (LN Cisneros <lnsea@earthlink.net>) |
| Список | pgsql-performance |
On Thu, 18 Sep 2003 12:27:23 -0700 (GMT-07:00), LN Cisneros
<lnsea@earthlink.net> wrote:
>But, the EXISTS version doesn't
Laurette,
looking at that SELECT statement again I can't see what's wrong with
it. One of us is missing something ;-)
> really give me what I want...
Can you elaborate?
SELECT code, id, date_of_service
FROM tbl
WHERE EXISTS (SELECT *
FROM tbl t2
WHERE t2.xxx >= '29800' AND t2.xxx <= '29909'
AND t2.code = 'XX'
AND tbl.date_of_service = t2.date_of_service) -- (!)
AND client_code = 'XX'
ORDER BY id, date_of_service;
>all rows in tbl that
^^^
Well, all that have client_code = 'XX', as in your original query.
> match the date of the subquery.
The matching is done by the line with the (!) comment.
Servus
Manfred
В списке pgsql-performance по дате отправления: