mysql 多表多字段报表填充查询

当需要2个数据从不同表时:

select *
from (  select count(id)as org_sum  FROM `jnx_drive` WHERE  user_id =1 and drive_type =1)as a1,
     ( select sum(money)as money,sum(score)as score FROM `sys_user`)as a2

 

继续添加字段:

,(SELECT count(id) FROM org WHERE user_id = "test_user_id"  and is_disable = 0  order by id DESC  )as a3

 

相关文章:

  • 2021-08-20
  • 2021-09-28
  • 2021-09-08
  • 2021-05-11
  • 2021-06-28
  • 2021-10-25
猜你喜欢
  • 2022-02-25
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-11-28
  • 2021-04-30
相关资源
相似解决方案