1, select count(b.order_id), count(distinct b.user_id), avg(current_price) from deal a,order b where a.deal_id=b.deal_id and a.deal_id=3423829 and sysdate between to_date(deal_start_time yyyy-mm-dd hh24:mi:ss) and to_date(deal_expire_time yyyy-mm-dd hh24:mi:ss) ;
2,select b.user_id from deal a,order b where a.deal_id=b.deal_id -- and a.deal_id=3423829 and sysdate between to_date(deal_start_time yyyy-mm-dd hh24:mi:ss) and to_date(deal_expire_time yyyy-mm-dd hh24:mi:ss) group by b.user_id having count(b.user_id)>1;
select * from deal a where a.deal_id exists( select b.user_id from order b where to_date(create_tim,'yyyy-mm-dd hh24:mi:ss') between to_date(deal_start_time,'yyyy-mm-dd hh24:mi:ss') and to_date(deal_expire_time yyyy-mm-dd,'hh24:mi:ss') group by b.deal_id,b.user_id having count(*)>1 )
请问您用的是什么软件编译的啊?我下了个sql server 但是一直让我链接服务器,我没有服务器,只是想自己建个表和库试试看,这种应该装什么软件呀?谢谢
select count(b.order_id),
count(distinct b.user_id),
avg(current_price)
from deal a,order b
where a.deal_id=b.deal_id
and a.deal_id=3423829
and sysdate between to_date(deal_start_time yyyy-mm-dd hh24:mi:ss)
and to_date(deal_expire_time yyyy-mm-dd hh24:mi:ss) ;
from deal a,order b
where a.deal_id=b.deal_id
-- and a.deal_id=3423829
and sysdate between to_date(deal_start_time yyyy-mm-dd hh24:mi:ss)
and to_date(deal_expire_time yyyy-mm-dd hh24:mi:ss)
group by b.user_id
having count(b.user_id)>1;
select b.user_id from order b
where to_date(create_tim,'yyyy-mm-dd hh24:mi:ss') between to_date(deal_start_time,'yyyy-mm-dd hh24:mi:ss') and to_date(deal_expire_time yyyy-mm-dd,'hh24:mi:ss')
group by b.deal_id,b.user_id having count(*)>1
)