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