Re: [INTERFACES] Problem using Having in a sub-query wit the Count function.
В списке pgsql-interfaces по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: [INTERFACES] Problem using Having in a sub-query wit the Count function. |
| Дата | |
| Msg-id | 26235.922287289@sss.pgh.pa.us обсуждение |
| Ответ на | Problem using Having in a sub-query wit the Count function. (Matthew <matt@ctlno.com>) |
| Список | pgsql-interfaces |
Matthew <matt@ctlno.com> writes:
>> "Select ordnum from ordinace where dept='Finance' and ordnum in
>> (Select ordnum from squareview where square='A') and ordnum in (select
>> ordnum from keywordview where keyword='Parade' or keyword='Public
>> Gathering' group by ordnum having count(ordnum) =2)"
I wonder whether the parser could be getting confused by the multiple
distinct uses of the same name "ordnum" in this query? In other words,
maybe you'd have better luck if the inner queries read something like
select
k.ordnum from keywordview k where k.keyword='Parade' or k.keyword='Public
Gathering' group by k.ordnum having count(k.ordnum) =2
Without that, it might be thinking that count(ordnum) refers to the
ordnum in the outer select.
If that is it, it's probably a bug, but I'm not sure what the standard
says about how to interpret ambiguous names in this context...
regards, tom lane
В списке pgsql-interfaces по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера