如何在 MySQL WHERE 子句中使用 CONCAT_WS() 函数?


当我们在 WHERE 子句中使用 CONCAT_WS() 函数时,输出将基于 WHERE 子句中提供的条件。可以从以下“学生”表的示例中理解这一点

示例

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)

更新日期: 2020 年 1 月 30 日

359 次浏览

开启你的 职业

通过完成课程获得认证

开始
广告
© . All rights reserved.