需求:
在实际数据库查询中可能需要将多个查询结果列并列显示。将查询结果并列成一张表。用GROUP_CONCAT关键字来实现查询结果的并列。
SELECT COUNT(*) wpcount,(SELECT GROUP_CONCAT(sub1.lpcount) FROM(SELECT COUNT(*) lpcount FROM limit_power_for_daily WHERE lp_lp_rate_fd>0.05 and lp_year=2019 and lp_month=7)sub1) lpcount,
(SELECT GROUP_CONCAT(sub2.npcount) FROM(SELECT COUNT(*) npcount FROM limit_power_for_daily WHERE ne_lp_rate_fd>0.05 and lp_year=2019 and lp_month=7)sub2) npcount
FROM limit_power_for_daily WHERE wp_lp_rate_fd>0.1 and lp_year=2019 and lp_month=7