9.1 Concatenate strings in two columns
Concatenate values in two columns into a single one in one column.
Get full names and salaries of employees in R&D department in New York. Below is Employee table:
ID | NAME | SURNAME | STATE | DEPT | SALARY |
---|---|---|---|---|---|
1 | Rebecca | Moore | California | R&D | 7000 |
2 | Ashley | Wilson | New York | Finance | 11000 |
3 | Rachel | Johnson | New Mexico | Sales | 9000 |
4 | Emily | Smith | Texas | HR | 7000 |
5 | Ashley | Smith | Texas | R&D | 16000 |
… | … | … | … | … | … |
SPL uses operator + to concatenate two strings.
SPL script:
A | |
---|---|
1 | =connect(“db”) |
2 | =A1.query@x(“select * from Employee”) |
3 | =A2.select(STATE==“New York”&&DEPT==“R&D”) |
4 | =A3.new(NAME+" "+SURNAME:FULLNAME, SALARY) |
A1 Connect to the data source.
A2 Import Employee table.
A3 Get records of employees working in New York R&D department.
A4 Use operator + to concatenate name string and surname string to get the full name.
Execution result:
FULLNAME | SALARY |
---|---|
Matthew Johnson | 6000 |
Lauren Thomas | 12000 |
Brooke Williams | 12000 |
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL