SELECT wle.*, 
		CASE
		WHEN '2017-08-10 14:00:00' > wle.et THEN '回看'
		WHEN wle.st >= '2017-08-10 14:00:00' AND '2017-08-10 14:00:00' < wle.et THEN '直播中'
		WHEN wle.st > '2017-08-10 14:00:00' < wle.et AND (wles.statusx IS NULL OR wles.statusx != '1') THEN '预约'
		WHEN wle.st >'2017-08-10 14:00:00' < wle.et AND wles.statusx = '1' THEN '巳预约'
		END statusx
	FROM wsp_live_epg wle LEFT JOIN wsp_live_epg_subscribe wles ON 
	(wle.id = wles.epg_id AND wles.user_id = '5l3y7yJwUpN4pdtjCFZYBpYFOt54Hfpz')
	WHERE wle.live_tv_id = 9
		AND wle.dt = '2017-08-10'

  记录一个mysql的case when用法

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-07-13
猜你喜欢
  • 2021-06-11
  • 2021-09-11
  • 2022-12-23
  • 2021-08-16
  • 2022-03-09
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案