需求:
在實際資料庫查詢中可能需要將多個查詢結果列並列顯示。將查詢結果並列成一張表。用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
mysql 查詢結果中自動加序號列
查詢mysql 資料庫 自動 新增 序號 欄位列1,2,3,4.就像這樣。select rowno rowno 1 as rowno,zhuanfacontent,content,senddate,sendtime,zhuanfaauthor,zhuanfalink from select zhua...
查詢合併列
select c.gid,c.stuname,d.pargid,d.parname from2 select 3a.gid a.name asstuname 4from base user a5 asc6left join7 select 8a.gid b.pargid,9a.name asparn...
mysql將查詢結果的行號作為列展示
mysql將查詢結果的行號作為列展示 其中,表名 pm user,select t.rownum rownum 1 as rownum from select rownum 0 r,pm user t 但是對於hibernate框架的專案來說,會報錯 space is not allowed aft...