php - Wrapping multiple rows into one row -
php - Wrapping multiple rows into one row -
i have dataset in mysql particular subject
want them collapsed downwards 1 row. number of rows wrap around varies. typical dataset create this:
column names: sitting date | subject | exam part 1 | exam part 2 | assignment part 1 | assignment part 2 | practical part 1 | practical part 2 | project part 1 | project part 2 | overall mark | result | credits
results:
052012 business info systems 0.00 0.00 51.0 0.00 0.00 0.00 0.00 0.00 42 f 10.00
052012 business info systems 29.0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42 f 10.00
what i'm trying wrap them 1 row like:
052012 | business info systems | 29.00 | 0.00 | 51.0 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 42 | f
how form such query in mysql? current query looks this:
select * exam_results sdate = :sdate , studno = :studno
you can utilize concat_ws
in mysql :
select concat_ws(' | ', `sitting date`, `subject`, <...>) `table`
php mysql sql
Comments
Post a Comment