0
如果有任何規則放置在JDBC結果聯合查詢任何人都可以建議? 我在數據庫中的聯合查詢在那裏我得到的輸出...但是當我試圖把同樣的聯合查詢ResultSet中,配售聯合查詢在結果
am getting an error:ASA Error -131: Syntax error near 'unionselect' on line ...
任何人都可以建議我,那是我出了問題......
在JSP頁面中查詢如下.....
String QueryString =
"select CONVERT(VARCHAR(7),[startdatetime],111) AS [year-month],nm.nameLine1 as CompanyName, sum(datediff(hour, startdatetime, enddatetime)) as total"
+" from servicerequestworklog as srl"
+" inner join ServiceRequest sr on srl.ServiceRequestId = sr.ServiceRequestId"
+" inner join Name nm on(sr.clientCustomerId = nm.customerId and nm.nameTypeId = 'OFIC')"
+" where (startdatetime >= '08-01-2011 00:00:00.000' and enddatetime <= '10-31-2011 00:00:00.000')"
+" group by CompanyName, [year-month]"
+"union"
+"select CONVERT(VARCHAR(7),[startdatetime],111) AS [year-month], 'ZZTOTAL' as CompanyName, sum(datediff(hour, startdatetime, enddatetime)) as total"
+" from servicerequestworklog as srl"
+"inner join ServiceRequest sr on srl.ServiceRequestId = sr.ServiceRequestId"
+" where (startdatetime >= '08-01-2011 00:00:00.000' and enddatetime <= '10-31-2011 00:00:00.000')"
+" group by [year-month]"
+"order by CompanyName, [year-month]" ;
非常感謝!...我的問題就解決了......爲u預期,其由於聯盟,並選擇之間的空間...... – sonu