A表:a1,time1
B表:time2
我想要得到結果是: time2,所有time1<=time2 的a1的個數
uj5u.com熱心網友回復:
是time1的時間小于所有time2的時間么?select count(a1) from a
where time1<=(select min(time2) from b);
uj5u.com熱心網友回復:
A表應該是:type1,type2,a1,time1B表:time2
得到結果是: type1,type2,time2,time1<=time2 and type1=a.type1 and type2=a.type2的a1的個數
uj5u.com熱心網友回復:
我需要把time2也顯示出來啊
uj5u.com熱心網友回復:
比如time2是'2019-10-06' 就要取A表中所有time1在2019-10-06之前的所有a1的去重計數uj5u.com熱心網友回復:
select t1.*, t2.*, count(distinct t1.a1) over(partition by t1.time1)from tab1 t1, tab2 t2
where t1.time1 <= t2.time2
and t1.type1 = t2.type1
and t1.type2 = t2.type2
uj5u.com熱心網友回復:
1、
select b.time2,count(a.a1)
from a,b
where a.time1 <= b.time2
group by b.time2;
2、總感覺樓主的這個統計沒太大意義。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/8497.html
標籤:開發
