Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

What is the syntax to concatenate two fields in a Database View Where clause?

Doug25
Kilo Contributor

What is the syntax to concatenate two fields in a Database View Where clause?  I need a variable and a text string to form one side of the Join comparison.

Example Where clause: sysuser_email = abc_variable_field + "@test.com".

I know this is not the correct syntax.  What is the correct syntax to concatenate the two fields?

Thanks a lot.

 

2 REPLIES 2

Rahul Kathuria
Tera Expert

Hi Doug,

Try this.

WHERE CONCAT(TRIM(customers.first_name), ' ', TRIM(customers.last_name)) LIKE '%John Smith%'

I'm tried this:

sysuser_email LIKE CONCAT(TRIM(cicomputer_u_last_login_name), '%@testing.com%')

and this:

sysuser_email = CONCAT(TRIM(cicomputer_u_last_login_name), '%@testing.com%')

 

but got syntax errors.  I'm trying this statement in a database view Where clause.

 

See anything wrong?