Computer >> Computer tutorials >  >> Programming >> MySQL

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)