ben_is_me

2016/1/18 问题记载

1:SELECT t.ID,t.CHANNEL_ID,t.`NAME`,t.LOGO,t.START_TIME,t.END_TIME,t.PROGRAM_DATE,
(SELECT GROUP_CONCAT(DISTINCT tca.NICK_NAME) FROM TBL_ANCHORPERSON_RESOURCE tar,TBL_CLOUDTB_ADMIN tca
WHERE t.ID=tar.RESOURCE_ID AND tar.TYPE=1 AND tar.ANCHORPERSON_ID = tca.ID GROUP BY tar.RESOURCE_ID ) ANCHORPERSON
FROM TBL_PROGRAM t
WHERE t.CHANNEL_ID =34
ORDER BY START_TIME ASC

2:SELECT t.ID,t.CHANNEL_ID,t.`NAME`,t.LOGO,t.START_TIME,t.END_TIME,t.PROGRAM_DATE,temp.ANCHORPERSON

FROM TBL_PROGRAM t,
(SELECT tp.id,GROUP_CONCAT(DISTINCT tca.NICK_NAME) ANCHORPERSON
FROM TBL_ANCHORPERSON_RESOURCE tar,TBL_CLOUDTB_ADMIN tca,tbl_program tp
WHERE tar.RESOURCE_ID=tp.ID AND tar.TYPE=1 AND tar.ANCHORPERSON_ID = tca.ID GROUP BY tar.RESOURCE_ID) temp
WHERE t.CHANNEL_ID = 34
AND temp.id=t.ID
GROUP BY `NAME`
ORDER BY START_TIME ASC

 

2的查询速度远远比1的快:

 

posted on 2016-01-18 19:13  ben_is_me  阅读(81)  评论(1编辑  收藏  举报

导航