sql - One-to-many join with multiple records as repeated columns -


using ms sql server. have build view columns 2 entities have one-to-many relationship. primary entity performance reports. table should have 1 performance report per row.

the related entity performance report logs. each record includes 1 problem , unlimited number of inputs. structure chosen in order able link problems inputs, rather having list of problems , inputs in performance report entity itself. each performance report log linked performance report via lookup.

i view have columns main performance report entity, followed columns related performance report logs. so, if performance report has 3 logs, columns 3 logs should included in same row, rather 3 rows. should in separate columns, not merged 1 in group_concat.

thank you!

is "an unlimited number of inputs"? if overstatement , might have 10-20 inputs, use select statement each input column wish display. i.e.,

select performance.field1, performance.field2,   (select field inputs problem='x' , inputs.id=performance.pk) x,  (select field inputs problem='y' , inputs.id=performance.pk) y,  etc...         performance 

Comments