mysql_query()不能通常解析sql

WBOY
发布: 2016-06-13 11:57:28
原创
1151 人浏览过

mysql_query()不能正常解析sql

一个sql语句,直接放到mysql里运行是正常的
但用php的mysql_query运行该sql后结果却不同,会是mysql_query不能解析的原因吗?




sql如下:



		INSERT INTO analysis.caomei_of_list_pvuv  <br />									(region,isp,uv,pv,date)  <br />									SELECT<br />										tb2.region,tb2.isp,tb2.uv,tb2.pv,'2014-05-14' AS date   <br />									FROM   <br />									(<br />										SELECT <br />											tb.region,tb.isp, COUNT(tb.mac) AS uv,<br />											SUM(tb.mac_num) AS pv  <br />										FROM <br />											caomei_20140515.caomei_1 AS tb <br />										WHERE <br />											tb.date = '2014-05-14'  <br />										GROUP BY tb.region, tb.isp <br />									) AS tb2  <br />									LEFT JOIN <br />									(<br />										SELECT <br />											tb6.region,tb6.isp,tb6.uv,tb6.pv <br />										FROM <br />											analysis.caomei_of_list_pvuv AS tb6 <br />										WHERE <br />											tb6.date='2014-05-14'   <br />									) AS tb1 	<br />										<br />									ON tb2.region = tb1.region <br />									WHERE <br />										tb1.region IS NULL  <br />										AND tb2.region IS NOT NULL <br /><br />									;
登录后复制

------解决方案--------------------
NSERT INTO analysis.caomei_of_list_pvuv  
                            (region,isp,uv,pv,date)  
                            SELECT
                                tb2.region,tb2.isp,tb2.uv,tb2.pv,'2014-05-14' AS date   
                            FROM   
                            (
                                SELECT 
                                    tb.region,tb.isp, COUNT(tb.mac) AS uv,
                                    SUM(tb.mac_num) AS pv  
                                FROM 
                                    caomei_20140515.caomei_1 AS tb 
                                WHERE 
                                    tb.date = '2014-05-14'  
                                GROUP BY tb.region, tb.isp 
                            ) AS tb2  
                            LEFT JOIN 
                            (
                                SELECT 
                                    tb6.region,tb6.isp,tb6.uv,tb6.pv 
                                FROM 
                                    

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!