I need to statistics of each user has withdrawal amount
I need statistics each user at the invitation of the number of friends
I need these two data in the user list, return together, record cash withdrawals and invitation list is need to call another
I used to practice is user table paging query out first, reoccupy two SQL request withdrawal record and invited table respectively, then put the data into the user list, return together,
I want to find a most efficient SQL query train of thought,
CodePudding user response:
You mean now, respectively two withdrawal amount and the number of friends to join to the user list,From the one picture data in another table:
The update pm_proj_b a
Set
Amy polumbo roj_zytz=(select decode (b.t zjh_zy, null, 0, b.t zjh_zy) from pm_month_report b where Amy polumbo roj_id=p. m_proj_id),
Amy polumbo roj_dftz=(select decode (b.t zjh_df, null, 0, b.t zjh_df) from pm_month_report b where Amy polumbo roj_id=p. m_proj_id),
Amy polumbo roj_pftz=(select (decode (b.t zjh_df, null, 0, b.t zjh_df) + decode (b.t zjh_zy, null, 0, b.t zjh_zy)) from pm_month_report b where Amy polumbo roj_id=p. m_proj_id)
Establishing storage tasks and a timing task:
The create or replace procedure STATISTICAL_DATA_VOLUME as
The begin
Insert into T_TUBE_DATA_COUNT select * from V_BASE_NUM;
Commit;
end;
CodePudding user response:
Recommend withdrawal amount is added in the user table, invite friends number two fields,The withdrawal amount, invite friends, the related data updates to these two fields,
Of course, the most began to initialize the practice in these two fields, to get the original data,
In this way, you check the user table only a single table can get data, and it is real time (without timing task),