How can CONCAT_WS() function be used with MySQL WHERE clause?


When we use CONCAT_WS() function with WHERE clause then the output would be based upon the condition provided in WHERE clause. It can be understood from the example of ‘Student’ table as follows

Example

mysql> Select CONCAT_WS(' ',Name, Last_name, 'Resident of', Address, 'is studying', Subject)AS 'Student Detail' from student WHERE id = 20;
+----------------------------------------------------------------+
| Student Detail                                                 |
+----------------------------------------------------------------+
| Gaurav Rathore Resident of Jaipur is studying Computers        |
+----------------------------------------------------------------+
1 row in set (0.00 sec)

Sharon Christine
Sharon Christine

An investment in knowledge pays the best interest

Updated on: 30-Jan-2020

286 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements