Left Join and concatenate two columns

Left Join and concatenate two columns

peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0
edited July 2021 in Editor

Using the following left join I want to concatenate two columns from the table 'unit':

      Field::inst( 'learning_event.unit_fk' )
            ->options( Options::inst()
                ->table( 'unit' )
                ->value( 'unit_pk' )
                ->label( 'unit_name' )
            ),
        Field::inst( 'unit.unit_name' )
->leftJoin( 'unit', 'unit.unit_pk', '=', 'learning_event.unit_fk' )

So that columns 'unit_name' and 'unit_code' are joined with a space. How can I do that?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Do you mean for the label shown in the Options list? Unfortunately it doesn't yet support a left join operation. It could be done with a VIEW though. Create the view which does the left join and then point the ->table() at that.

    Allan

Sign In or Register to comment.