如何编写将列信息拆分为单个行的SQL查询?

时间:2015-11-29 05:06:31

标签: mysql sql sql-server database

我需要让我的查询返回三行,其内容为:

Theater        Screen       Begins 
cinemark 17    8            2015-11-21 10:50
cinemark 17    8            2015-11-21 12:10
cinemark 17    8            2015-11-21 2:23

我只返回一行,显示带有日期和所有三个显示时间的“开始”列。我不确定如何将时间分成不同的行。

这是我的工作:

SELECT 
NAME AS 'THEATER', TITLE AS 'TITLE', SCREEN_SCREEN_ID AS 'SCREEN', 
CONCAT(DATE, ' ',TIME) AS 'BEGINS'

FROM MOVIE_has_THEATER MT
INNER JOIN THEATER TH
ON MT.THEATER_THEATER_ID = TH.THEATER_ID

INNER JOIN MOVIE MO
ON MT.MOVIE_MOVIE_ID = MO.MOVIE_ID

INNER JOIN SCREEN SC
ON MT.SCREEN_SCREEN_ID = SC.SCREEN_ID 

WHERE TITLE = 'spectre' AND NAME = 'cinemark 17';

0 个答案:

没有答案