| От | Josh Berkus |
|---|---|
| Тема | Re: Inner join syntax |
| Дата | |
| Msg-id | web-1782515@davinci.ethosmedia.com обсуждение исходный текст |
| Ответ на | Inner join syntax ("Chad Thompson" <chad@weblinkservices.com>) |
| Список | pgsql-novice |
Chad,
> select distinct on (l.full_phone) l.full_phone, l.id
> from lists l inner join timezone tz on l.area_code = tz.area_code
> inner join tiers t on phonenum_substr(l.full_phone) = t.npanxx
> where l.client_id = 16
> and l.list_of_lists_id = 170
> and tz.greenwich = '-7'
> and t.tier in ('A','B')
>
> I am trying to add the following restriction to the above query. And
> I'm lost some where.
>
> where not exists (
> select cr.phonenum
> from call_results cr
> where client_id = 16
> and l.full_phone = cr.phonenum)
You're gonna feel silly ... you just need to replace the second "WHERE"
with an "AND", i.e. ...
AND NOT EXISTS (
SELECT cr.phonenum ...
-Josh Berkus
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера