SELECT id,
created_time,
title,
CASE source
WHEN 0 THEN 'MOBILE'
WHEN 1 THEN 'WEB'
WHEN 2 THEN 'SERVICE'
ELSE 'UNKNOWN'
END as `upload_source`,
private_type,
CONCAT('http://huypv.net/', path_dir, '/', filename) as `media_url`
FROM vn_media
WHERE user_id=2011;
Title:
MySQL - Select case when Example
Description:
SELECT id, created_time, title, CASE source WHEN 0 THEN 'MOBILE' WHEN 1 THEN 'WEB' ...
...
Rating:
4