下面是查询
select DISTINCT movie_master.MovieMasterID, MOVIE_VERSION.ReleaseDate,
movie_master.displayorder,movie_classification.mc_code,
movie_master.title As Title,
movie_master.BioCast,movie_master.BioDirector,movie_master.LinkWord,
CASE WHEN ((DATEDIFF(day,MOVIE_VERSION.ReleaseDate,getdate()) <=7) and (DATEDIFF(day,MOVIE_VERSION.ReleaseDate,getdate()) >=0)) THEN 'JUST RELEASED' ELSE '' END AS RELEASETAG,
movie_master.Synopsis,movie_language.NAME as Language,
CASE WHEN movie_master.DistributorID = 8 THEN 0 ELSE 9999 END AS distributororder,
movie_distributor.name as distributor
from movie_master
left join MOVIE_LANGUAGE on MOVIE_MASTER.Language = movie_language.languageid
left join movie_distributor on MOVIE_MASTER.distributorid = movie_distributor.distributorid
left join movie_version on MOVIE_MASTER.MovieMasterID = MOVIE_VERSION.MovieMasterID
left join movie_classification on MOVIE_MASTER.classification = movie_classification.classificationid
left join movie_itemdetails on MOVIE_MASTER.MovieMasterID = movie_itemdetails.MovieMasterID
where MOVIE_VERSION.ReleaseDate <= convert(varchar, GETDATE(), 101)
and MOVIE_VERSION.MovieMasterID = movie_master.MovieMasterID
and movie_master.classification = movie_classification.classificationid
and movie_master.MovieMasterID = movie_itemdetails.MovieMasterID and movie_itemdetails.fieldid = 1 and movie_itemdetails.Type ='TRAILER'
and ((MOVIE_VERSION.FilmCode in (SELECT DISTINCT FILMID FROM MOVIE_TEMP)) OR (MOVIE_VERSION.Title in (SELECT DISTINCT TITLE FROM MOVIE_TEMP)))
AND LEFT(MOVIE_VERSION.FILMCODE,1) <> 6
and MOVIE_VERSION.Enabled = 1
AND MOVIE_MASTER.Enabled = 1
AND (MOVIE_MASTER.MovieMasterID in (SELECT DISTINCT MOVIE_MASTER.MovieMasterID FROM MOVIE_MASTER))
order by MOVIE_MASTER.displayorder, MOVIE_VERSION.ReleaseDate desc, distributororder, MOVIE_MASTER.TITLE
和结果集
310 2013-03-01 00:00:00.000 9999 NA test456 JUST RELEASED NA 9999
310 2013-02-28 00:00:00.000 9999 NA test456 JUST RELEASED NA 9999
244 2013-02-10 00:00:00.000 9999 U I Love Hong Kong 2013 Alan Tam, Veronica Yip, Natalis Chan, Eric Tsang, Stanley Fung, Bosco Wong, Michael Tse, Kate Tsui, Joyce Cheng Chung Shu-Kai The story takes place in the 1970s until modern times, in which all families are happily prepare and welcome the Chinese New Year in Hong Kong. However, a traditional restaurant in Yau Ma Tei faces terrible problem. At last, everything solved with the neighbours’ kind support and assistance as happy ending. CANTONESE 0
我的问题是,如何进一步增强我的查询以区分相同的记录?