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

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

 

上一篇:JavaScript 各种验证收集


下一篇:Rust 枚举