Skip to content

How can I concatenate two columns? #1691

Answered by simolus3
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Columns added in as() should be simple references. I see that neither the docs nor the error message are particularly clear on this, I'll improve the UX here. The reason for that is that we need a name for the column, which we read from the getter.

So you can do

abstract class Bookings extends View {
  Companies get c;
  // ...

  Expression<String> get company => c.firstname + c.lastname;

  @override
  Query as() => select([
        c.firstName,
        c.lastName,
        company,
        p.projectName,
        e.shootingDay,
        c2.token,
        c2.lastName,
        c2.firstName,
        p2.checkIn,
        p2.checkOut,
        p2.role,
      ]).from(c).join([
        innerJoin(p…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant