Re: Extend inner join to fetch not yet connected rows also
| От | Jan Kohnert |
|---|---|
| Тема | Re: Extend inner join to fetch not yet connected rows also |
| Дата | |
| Msg-id | 1695753.vyHXCZFGd1@kohni-mobil обсуждение исходный текст |
| Ответ на | Re: Extend inner join to fetch not yet connected rows also (Arup Rakshit <ar@zeit.io>) |
| Ответы |
Re: Extend inner join to fetch not yet connected rows also
|
| Список | pgsql-general |
Hi Arup,
Am Sonntag, 22. September 2019, 14:48:20 CEST schrieb Arup Rakshit:
> Hi Jan,
>
> > On 22-Sep-2019, at 5:38 PM, Jan Kohnert <nospam001-lists@jan-kohnert.de>
> > wrote:
> > maybe something like
> >
> > select
> >
> > c.id,
> > c.name,
> > case when cs.user_id = 8 then true else false end as has
> >
> > from craftsmanships c
> > left join contractor_skills cs
> >
> > on cs.craftsmanship_id = c.craftmanship_id;
>
> But this query fetched duplicate data:
yeah, that's possible, since I don't exactly know your data model. If only the
values above are required, you could simply use distinct:
select distinct
c.id,
c.name,
case when cs.user_id = 8 then true else false end as has
from craftsmanships c
left join contractor_skills cs
on cs.craftsmanship_id = c.id
order by
c.id;
--
MfG Jan
В списке pgsql-general по дате отправления: