Is there any SQL or MySQL query to display all the data in a form of a sentence?

Devendra Yadav :

I want to display the data in a sentence like "SMITH HAS HELD THE POSITION OF CLERK IN DEPT 20 FROM 1981". How can i do this in MySQL ?? Where I'll retrieve the name , job , hiredate and dept no. from the table And sorry I'm totally new to stack overflow

Mangesh Auti :

You need to use CONCAT() function to create a sentence using different values from a table column. for eg.

SELECT
concat(upper(name)," HAS HELD THE POSITION OF ",upper(job)," IN DEPT ",deptno," FROM ",year(hiredate)) as EmployeeInfo
FROM tbl;

DEMO

you can change the query according to your requirement (as you did not provide any data we are can't provide exact query).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=217525&siteId=1