| From: | Jan Kohnert <nospam001-lists(at)jan-kohnert(dot)de> |
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Extend inner join to fetch not yet connected rows also |
| Date: | 2019-09-22 13:25:46 |
| Message-ID: | 1695753.vyHXCZFGd1@kohni-mobil |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)jan-kohnert(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Arup Rakshit | 2019-09-22 13:30:38 | Re: Extend inner join to fetch not yet connected rows also |
| Previous Message | Arup Rakshit | 2019-09-22 12:48:20 | Re: Extend inner join to fetch not yet connected rows also |