select *
from (select rownum RN, B.*
from (Select Distinct
T.REGION_NAME,
T.AREA_NAME,
T.CENTER_NAME,
T.GRID_NAME,
T.POINT_NAME,
T.POINT_ID,
B.product_code,
B.Organise_Id,
B.TO_MOBILE,
RECOMMEND_DATETIME,
reommendRecord,
S.LOGIN_NAME,
P.PRO_START_TIME,
P.PRO_END_TIME
From tb_product_info
P,
Sys_user_info S,
tview_organise_super T,
(Select
T1.FROM_MOBILE,
T1.TO_MOBILE,
T1.Product_Code,
T1.Emp_No,
T1.Organise_Id,
To_Char(T1.Recommend_Datetime,
'YYYY-MM-DD') RECOMMEND_DATETIME,
Count(*)
Reommendrecord
From Tb_Recommend_Info
T1
Group By To_Char(T1.Recommend_Datetime,
'YYYY-MM-DD'),
T1.FROM_MOBILE,
T1.TO_MOBILE,
T1.Product_Code,
T1.Organise_Id,
T1.Emp_No)
B
Where B.Organise_Id = T.POINT_ID
And
B.Emp_NO = S.EMP_NO
And B.Product_Code =
P.product_code
And Reommendrecord >
1
and T.ORGANISE_CODE like 'SCAA%'
and 1 = 1
Order By RECOMMEND_DATETIME Desc) B)