I have a View with a one to many relationship. ID and Session are in my main table, and "mark"'s are rows in a custom table. When I look up a single ID, I get this result because of the 'many' results in the custom table.

ID | Session | mark

15 | Spring 2013 | 16

15 | Spring 2013 | 3

15 | Spring 2013 | 5.5

My desired result is:

ID | Session | mark 1 | mark 2 | mark 3

15 | Spring 2013 | 16 | 3 | 5.5

  • depends if you want separated columns for each mark, or if all marks in the same column is allowed ?
    – pico34
    Commented Aug 23, 2013 at 13:56

3 Answers 3


How about using the viewsfield module? You can try solving your problem by creating two views A and B, such that -

  1. View A excepts an argument 'ID' and lists all the marks associated with it, by having only the 'marks' field included for display/output.
  2. View B has an ID field, a session field, and a viewsfield. In this third field the view A is embedded.

I hope this helps. I have not tried this, but I am reasonably sure it should help if the module is doing what it promises to do.


I advice you to use a custom php method inside each mark column

See Views php module

Your method could return the right value based on the delta index :

// in the custom php field (view)
return _my_method( $data->field_mark, 1 ); //(value, delta)

//do it 3 times, in each column
return _my_method( $data->field_mark, 2 ); //(value, delta)
return _my_method( $data->field_mark, 3 ); //(value, delta)

// in your module
function _my_method( $marks, delta ){
  return isset( $marks->['und'][ delta ]['value'] ) ? $marks->['und'][ delta ]['value'] : NULL;
  • i know the module above is still in dev, but it's a suggestion of code
    – pico34
    Commented Aug 23, 2013 at 13:58

Have you tried grouping your fields under the Format settings?

  • I just tried "Use grouping" under "Advanced settings", which provides a wrench on all of my fields but "Group results together" on "mark" doesn't do anything.
    – Russell
    Commented Aug 22, 2013 at 21:05
  • Try grouping on ID Commented Aug 23, 2013 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.