67,541
社区成员
发帖
与我相关
我的任务
分享
SELECT reportDate,a.param,b.model,b.price,SUM( CASE WHEN a.dataType like 'FB%' THEN a.dataCount ELSE 0 END) as flightcount, b.hotelprice,SUM( CASE WHEN a.dataType like 'HB%' THEN a.dataCount ELSE 0 END) as hotelcount
FROM report201209 a, clientinfo b
WHERE a.param = b.modelID AND (b.startTime='' or a.reportDate>=b.startTime) AND (a.reportDate<=b.endTime or b.endTime='')
AND dataType IN ('FB_OHDI', 'FB_NHDI', 'FB_NBDI', 'FB_OBDI', 'FB_OD2I', 'FB_ND2I', 'FB_OFCI', 'FB_NFCI', 'FB_OOTI', 'FB_NOTI' ,'FB_OHDD', 'FB_NHDD', 'FB_NBDD', 'FB_OBDD', 'FB_OD2D', 'FB_ND2D', 'FB_OFCD', 'FB_NFCD', 'FB_OOTD', 'FB_NOTD', 'HB_O', 'HB_N')
AND b.modelID IN ('114115','530la','93113','ap_1296d1901f0','ap_1298c9526fb','ap_12a13771275','ap_12e8f8ae6bd','ap_12ee0af6c22','ap_12f5357cf8e','ap_12f76efa302','ap_12f76f32e82','ap_1300138fdd9','ap_13349c8a7d7','ap_136f38d49a6','ap_1372560e926','auto4f5da71a','auto_4eaa7303','auto_4eba55f3','auto_4eba55fa','auto_4eba5603','auto_4eba5621','auto_4eba574d','auto_4eba5754','auto_4eba575c','auto_4efebc19','auto_4efebc27','auto_4f052092','auto_4f0e8e48','auto_4f0e8fe3','auto_4f4def9f','auto_4f4df13d','auto_4f599da1','auto_4f5da71a','auto_4f5qd994','auto_4f97c52d','auto_4fb227b3','auto_5003eaf3','auto_50191b2c','auto_50191b2d','auto_50191b2e','auto_50191b2f','auto_50191b30','auto_50191b31','auto_50191b32','auto_50191b33','auto_50191b34','auto_50191b35','auto_50191b36','auto_50191b37','auto_50191b38','auto_50191b39','auto_50191b3a','auto_50191b3b','auto_50191b3c','auto_50191b3d','auto_50191b3e','auto_50191b3f','auto_50191b40','auto_50191b41','auto_50191b42','auto_50191b43','auto_50191b44','auto_50191b45','auto_50191b46','auto_50191b47','auto_50191b48','auto_50191b49','auto_50191b4a','auto_50191b4b','auto_50191b4c','auto_50191b4d','auto_50191b4e','auto_50191b4f','auto_50191b50','auto_50191b51','auto_50191b52','auto_50191b53','auto_50191b54','auto_50191b55','auto_50191b56','auto_50191b57','auto_50191b58','auto_50191b59','auto_50191b5a','auto_50191b5b','auto_50191b5c','auto_50191b5d','auto_50191b5e','auto_50191c20','auto_50191c21','auto_50191c22','auto_50191c23','auto_50191c24','auto_50191c25','auto_50191c26','auto_501f8251','auto_5024d019','auto_5024d02a','auto_503aeb86','auto_503aeb89','auto_503aeb8b','auto_503aeb8d','auto_503aeb8f','auto_503aeb91','auto_503aeb93','auto_503aeb95','auto_503aeb97','auto_503aeb99','auto_503b4632','auto_503b4633','auto_503b4634','auto_503b4635','auto_503b46f2','auto_503b46f3','au_hao90','au_ie189','au_ok1616','dfly=1122','dfly=1122b','dfly=114115','dfly=114115a','dfly=114FA1','dfly=114fa2','dfly=114fa3','dfly=123wa ','dfly=2345a','dfly=2345a1','dfly=2345a2','dfly=256cc','dfly=256cc1','dfly=568b','dfly=5w','dfly=776la4','dfly=776la5','dfly=776la6','dfly=776la7','dfly=8420','dfly=8420a','dfly=8420b','dfly=88488','dfly=88488a','dfly=88488d','dfly=91ni','dfly=91nia','dfly=92so','dfly=92so1','dfly=92so2','dfly=93113','dfly=93113a','dfly=93113c','dfly=9384c ','dfly=bebc','dfly=bebc4','dfly=bebc5','dfly=bebc6','dfly=bebc7','dfly=bebc8','dfly=bebc9','dfly=fedfe','dfly=fedfe1','dfly=fg001','dfly=fhoa','dfly=fhoa1','dfly=ibbc','dfly=ie189a','dfly=jiangmin','dfly=jiangmin1','dfly=jiangmin2','dfly=jjol','dfly=jjol4','dfly=jjol5','dfly=ok1616','dfly=pc123','dfly=taobao','dfly=taobao,dfly=1122b','dfly=tg1234','dfly=tg1234a','dfly=tg1234b','dfly=vvbooo2','dfly=woso','dh=jj','gjjp=93113e','hao90sou','jjol')
AND a.reportDate ='2012-09-01' GROUP BY reportDate,a.param ORDER BY reportDate,a.param ;
1 SIMPLE b ALL 112 Using where; Using temporary; Using filesort
1 SIMPLE a ALL Index_reportDate,Index_query 36466422 Using where; Using join buffer
1 SIMPLE a ref Index_reportDate,Index_query Index_query 472 const,const,const 1 Using where
1 SIMPLE b ALL 112 Using where
1 SIMPLE a ref Index_reportDate Index_reportDate 32 const 1712586 Using where; Using temporary; Using filesort
1 SIMPLE b ALL 272 Using where; Using join buffer