mysql语句四表联查 以及sql内格式化时间戳

 这是我写过最长的mysql语句了    涉及了 left join   和 mysql内格式化时间戳 知识点

"select v.id,q.orderid,q.openid,FROM_UNIXTIME(q.verified_time,'%Y-%c-%d %h:%i:%s') as verified_time,o.name from  guanfu_ticket.order_verify as v 
		left join guanfu_ticket.order_qrcode as q on v.qrcode_id=q.id
		left join guanfu_ticket.order_record as r on q.orderid=r.id
		left join guanfu_ticket.verify_openid as o on v.verify_openid=o.openid
		where q.ticket_museum = '$bill_type' and q.verified_time >= $start_time and q.verified_time < $end_time"

 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页