Concatenate Fields via ODBC Query

Today I wanted to concatenate some fields with some text. We are pulling some data from MYOB for import against a client record in SugarCRM and want to tidy it up as we go.

However, using concat didn’t work.

Thus this Stackoverflow answer came to the rescue with using fn concat('some text', 'with more text')

I’ve then nested it a little as this function only takes two arguments.select


  Customers.CreditLimit,
  {fn concat (TermsOfPayment.Description,
    {fn concat (' (',
      {fn concat (Terms.BalanceDueDays, ' days)')}
    )}
  )} as TradingTerms
from
  Customers
  join Terms on Terms.TermsID = Customers.TermsID join
  TermsOfPayment on TermsOfPayment.TermsOfPaymentID = Terms.TermsOfPaymentID;

That did the trick.

Written on July 25, 2017