I have been struggling with this for last couple days. can someone help?
Here is my sql
SELECT
rd.id, rd.registration_id, rd.retreat_detail_id, rd.retreat_user_detail_id, rd.seva_remarks,
rd.can_do_seva, rd.preassigned_seva,rd.no_heavy_lifting, rd.no_repetitive_motion, rd.sitting_seva,
concat(ru.first_name, ‘ ‘, ru.last_name) as name,rd.total_seva_mins_allocated,
x.currently_assigned
from
registration_detail rd
inner join registration r on rd.registration_id = r.id AND rd.status <> “CANCELLED” AND r.status <> “CANCELLED”
inner join retreat_user_detail ru on rd.retreat_user_detail_id = ru.id
inner join retreat_detail rdt on rdt.retreat_id = 1 AND rd.retreat_detail_id = rdt.id
left join (select usa.reg_detail_id, group_concat(sd.day_number, “t” , sd.name, ” “, sd.start_time, ” “, sd.end_time, “n”) as currently_assigned from seva_detail sd inner join user_seva_allocation usa on usa.seva_detail_id = sd.id group by usa.reg_detail_id ) x on x.reg_detail_id = rd.id
where
rd.registration_id = 1430;
i was able to string together a couple inner joins but have not been able to match the sql once i add the left join requirements…
ramesh kannan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.