SQL error when trying to use sortOrder on Matrix related block (Craft 2) I'm getting the following SQL error when trying to simply order related entries in a Matrix block. Anyway around this?


  CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'sortOrder' in order clause is ambiguous. The SQL statement executed was: SELECT elements.id, elements.type, elements.enabled, elements.archived, elements.dateCreated, elements.dateUpdated, ...


This is what's throwing the error:

{% set package = craft.entries({
relatedTo: block,
order: 'sortOrder'}) %}
So this was me being a bit of a numpty here. I was calling the field the wrong way. Doing the following obeys the sort order from the field:

{% for entry in block.hostingPackage %}