我試圖獲得更多的列從總結2頁不同的表多個查詢相同的表,但在不同的列的mysql
SET @start_res = 20150301;
SET @finish_res= 20150501;
SET @finish_check= 20150801;
SET @start_check= 20150301;
SET @daily_hos= 3;
SELECT* from
(SELECT COUNT(DAY_IN) AS arr FROM t_hospital WHERE DAY_IN between @start_check and @finish_check and RES_DATE between @start_res and @finish_res and ID_daily_hos [email protected]_hos group by DAY_IN )e,
(SELECT COUNT(PAT_STATUS) AS ONG1 FROM t_hospital WHERE PAT_STATUS like '%ong%' and DAY_IN between @start_check and @finish_check and RES_DATE between @start_res and @finish_res and ID_daily_hos [email protected]_hos group by DAY_IN) a,
(SELECT COUNT(PAT_STATUS) AS RTED FROM t_hospital WHERE PAT_STATUS like '%rtde%'and DAY_IN between @start_check and @finish_check and RES_DATE between @start_res and @finish_res and ID_daily_hos [email protected]_hos group by DAY_IN )b,
(SELECT COUNT(PAT_STATUS) AS POLI FROM t_hospital WHERE PAT_STATUS like '%pol%'and DAY_IN between @start_check and @finish_check and RES_DATE between @start_res and @finish_res and ID_daily_hos [email protected]_hos group by DAY_IN )c,
(SELECT COUNT(PAT_STATUS) AS para FROM t_hospital WHERE PAT_STATUS like '%para%' and DAY_IN between @start_check and @finish_check and RES_DATE between @start_res and @finish_res and ID_daily_hos [email protected]_hos group by DAY_IN )d
,當然這是行不通的結果,只是第一個顯示的列(ARR)而其他人顯示錯誤的輸出。
我在哪裏錯了?
[SELECT \ * FROM multiple tables are possible duplicate。 MySQL](http://stackoverflow.com/questions/12890071/select-from-multiple-tables-mysql)...你需要將這些表連接在一起。 –
您的表格e,a,b,c,d不會*彼此連接 –