For a college assignment I need to show the last column of output data in parentheses as shown below.
My current query is:
SELECT
SUBSTRING(FirstName,1,1) AS '',
'.' AS '',
LastName AS '', UPPER(Title) AS ''
FROM employees
WHERE (Title != 'Sales Representative');
This query shows the output as:
B . Brown STOREMAN
C . Carr RECEPTIONIST
D . Dig DRIVER
I need it to show:
B . Brown (STOREMAN)
C . Carr (RECEPTIONIST)
D . Dig (DRIVER)
You should be able to do this using the CONCAT function
SELECT
SUBSTRING(FirstName,1,1) AS '',
'.' AS'',
LastName AS '', CONCAT('(',UPPER(Title),')') AS ''
FROM employees
WHERE (Title !='Sales Representative');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With