データ構造は正規化されていません。ただし、このパスを使用する場合は、次を使用してください:
select sub.student
FROM (
select t.timestamp,
t.Name,
t.Total,
c.col AS student,
case c.col
when 'Student1' then Student1
when 'Student2' then Student2
when 'Student3' then Student3
-- ...
end as d
from mytable t
cross join
(
select 'Student1' as col
union all select 'Student2'
union all select 'Student3'
-- ...
) c
) AS sub
WHERE sub.timestamp = '20150911'
AND sub.d > 0;
-- sub.d = 'NA'
-- sub.d = 0
出力:
╔══════════╗
║ student ║
╠══════════╣
║ Student1 ║
║ Student2 ║
╚══════════╝
カンマ区切りの結果が必要な場合は、次を使用してください:
select GROUP_CONCAT(sub.student ORDER BY sub.student) AS result
出力:
╔═══════════════════╗
║ result ║
╠═══════════════════╣
║ Student1,Student2 ║
╚═══════════════════╝