Create a SQL query for Postgres to get latest two rows for every foreign key
€8-30 EUR
ชำระเงินเมื่อจัดส่ง
Hello all,
I have three tables that need to be joined and then get 2 or more entries as result. I have already created the query for getting one result per id of one table.
Select [login to view URL] as project_id, [login to view URL], [login to view URL], responsible, status, workedtimelastthreemonth, jtbd, achievements, [login to view URL] as projectupdate_id, roadblock, progressupdate, nextsteps, milestones, created_at from devprojects_scheme RIGHT JOIN (
SELECT project_id, COALESCE(sum(upper(tsrange(starttime,endtime)) - lower(tsrange(starttime,endtime)))*userhourweight.cost_weight*0.01, interval '0 minute')
as workedtimelastthreemonth from tasks
left join userhourweight on tasks.user_name=userhourweight.user_name
WHERE starttime >= current_date - interval '3' month
and starttime < current_date GROUP BY project_id, userhourweight.cost_weight
) as d on [login to view URL] = d.project_id
left join (
select distinct on (project_id) * from projectupdates WHERE created_at IS NOT NULL
order by project_id, created_at desc
) as b on [login to view URL] = b.project_id
หมายเลขโปรเจค: #30747575
เกี่ยวกับโปรเจกต์
มอบให้กับ:
Hi, your job posting (Create a SQL query for Postgres to get latest two rows for every foreign key) has caught my attention, and I wish to have a conversation about the project. I read and understand your job post. Wit เพิ่มเติม
freelancer 3 คน กำลังเสนอราคาในงานนี้ โดยมีราคาเฉลี่ยอยู่ที่ €28
Hey I am a Full stack developer and have great command with Database queries so willing to assist you with your tasks so feel free to contact
Good Morning! I have been working with sql/PostGreSQL for more than 5 years. I'm interested in your project.