首页 > 数据库技术 > 详细

sql 语句总结

时间:2020-05-07 17:46:53      阅读:45      评论:0      收藏:0      [点我收藏+]

一、查询结果字符拼接

SELECT t.*, CONCAT(IFNULL(d.device_num,‘‘),IFNULL(d1.device_num,‘‘)) AS deviceNum,d.device_name,pr.name AS provinceName,cr.name AS cityName,dr.name AS districtName  FROM simcard t
    LEFT JOIN emergency d ON t.device_id = d.id
    LEFT JOIN battery d1 ON t.device_id = d1.id
    LEFT JOIN region pr ON pr.id=t.province_id
    LEFT JOIN region cr ON cr.id= t.city_id
    LEFT JOIN region dr ON dr.id=t.district_id
   

 

sql 语句总结

原文:https://www.cnblogs.com/lufei33180/p/12844312.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!