พอใช้ คำสั่ง union แล้วมันขึ้น error แบบนี้อ่ะคับ ผิดพลาดตรงไหนช่วยดูให้หน่อยคับบ
Code
select distinct A.ani,
A.telco,
A.sv_id,
A.ssv_id,
A.onmonth,
A.savedate,
rownum
from (select ani, telco, sv_id, ssv_id, onmonth, savedate, count(*)
from thebugims.smstransaction_201108
where savedate between '20110816' and '20110926'
and sv_id = '9'
and ssv_id = '4'
and dn_status = 'Y'
and dn_result = 'OK'
group by ani, telco, sv_id, ssv_id, onmonth, savedate
having count(*) = 1
ORDER BY dbms_random.value
union
select ani, telco, sv_id, ssv_id, onmonth, savedate, count(*)
from thebugims.smstransaction_201109
where savedate between '20110816' and '20110926'
and sv_id = '9'
and ssv_id = '4'
and dn_status = 'Y'
and dn_result = 'OK'
group by ani, telco, sv_id, ssv_id, onmonth, savedate
having count(*) = 1
ORDER BY dbms_random.value) A
where rownum <= 10