           ddl.study_name_clean,
           ddl.item_group_id,
           ddl.item_ordinal_per_ig_over_crfv,
-          ddl.item_multi_order_over_rsi NULLS FIRST), chr(44)),
+          ddl.item_multi_order_over_rsi NULLS FIRST,
+          ddl.column_sequence), $$,$$),
       (SELECT group_footer
        FROM format_strings)
     ) AS create_statement,

                  cols.item_group_id
                ORDER BY
                  cols.item_ordinal_per_ig_over_crfv,
                  cols.item_multi_order_over_rsi),
              0,
              200000,
              1000) AS item_group_bucket,

              item_group_oid,
              item_group_repeat,
              jsonb_object_agg(av_ident_final, data_text)
                FILTER (WHERE cast_failure) AS cast_failures,
            %5$s %6$s $f$ :: TEXT AS group_header,
      $f$ FROM study_ig_clinicaldata
          GROUP BY
