Reputation: 147
I have two tables like this:
Employee Table:
EmployeeID | firstName | lastName |
---|---|---|
1 | Johnny | Depp |
2 | Rebecca | Smith |
3 | Rodger | Doe |
Sales Table:
EmployeeID | Sales |
---|---|
1 | 100.20 |
2 | 200.19 |
3 | 355.23 |
And I'd like to join the tables to do something like this:
EmployeeID | fullName | Sales |
---|---|---|
1 | Johnny Depp | 100.20 |
2 | Rebecca Smith | 200.19 |
3 | Rodger Doe | 355.23 |
How would I do that? Here's what I tried so far:
SELECT employee.firstName + employee.lastName AS fullName, employeeID, sales
FROM employee i
INNER JOIN Sales s ON s.customerID = i.CustomerID
I'm getting a syntax error at my "+" symbol.
What's my problem?
Upvotes: 0
Views: 649
Reputation: 24568
as @Gordon said ,use CONCAT()
:
SELECT CONCAT(employee.firstName, ' ', employee.lastName) AS fullName
, employeeID
, sales
FROM employee i
INNER JOIN Sales s
ON s.customerID = i.CustomerID
Upvotes: 2