WITHtempAS(SELECT*FROM honghu_ads_log )SELECT
DATE_FORMAT(`create_date`,'%Y-%m-%d')AS xaxis,(SELECTcount( id )FROMtemp)AS qv,(WITH uTemp AS(SELECT*FROMtempGROUPBY ip )SELECTcount( id )FROM uTemp )AS uv,(SELECTcount( id )FROMtempWHERE op_type ='landing_click')AS landing_qv,(WITH uTemp AS(SELECT*FROMtempWHERE op_type ='landing_click'GROUPBY ip )SELECTcount( id )FROM uTemp )AS landing_uv
FROMtempGROUPBY
xaxis
如果需要做多个临时表(用,隔开即可)
with a as(select1as id from dual unionallselect2as id from dual),
b as(select1as id,'Adam'as name from dual unionallselect3as id,'Tom'as name from dual)select a.id,b.name from a leftjoin b on a.id=b.id