007sx

rds 不支持账户A 给账户B 创建授权存储过程,只能是当前登录账户给自己创建,要登陆对应账户删除原有存储过程重新创建即为修改。

 

例子如下:

先登陆新账号然后执行如下sql语句即可:

DROP PROCEDURE IF EXISTS `sp_channel_report`;
CREATE DEFINER = CURRENT_USER PROCEDURE `sp_channel_report`()
BEGIN
    
    set @largeLoan = 10007;
    set @today = curdate();
    
    select concat(\'[\',group_concat(concat(\'{"name":"\',a.name,
        \'","largeLoanAccessTotal":\',(select count(type) from access_url_log where type=0 and dc_id=a.id and upi_id=@largeLoan),
        \',"largeLoanClickTotal":\',(select count(type) from access_url_log where type=1 and dc_id=a.id and upi_id=@largeLoan),
        \',"loanEntranceClickTotal":\',(select count(type) from access_url_log where type=1 and dc_id=a.id and upi_id>@largeLoan and to_days(create_time)=to_days(now())),
        \',"loanEntranceAccessTotal":\',(select count(id) from (select id,dc_id from access_url_log where type=0 and upi_id>@largeLoan group by dc_id,ip_addr) t where dc_id=a.id),
        \',"todayUserAccessTotal":\', (select count(dc_id) from (select dc_id,ip_addr from access_url_log where create_time>=@today and upi_id>@largeLoan group by dc_id,ip_addr) t where dc_id=a.id),
        \'}\')), \']\') as str
    from download_channel a;
    
END;

 

分类:

技术点:

相关文章:

  • 2021-11-12
  • 2022-12-23
  • 2021-11-12
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-10
  • 2021-04-06
  • 2022-12-23
  • 2022-01-10
  • 2021-12-08
  • 2022-12-23
相关资源
相似解决方案