vba搜索java里面的sql_在EXCEL中使用SQL语句查询集锦-持续更新中,敬请关注
StrA = ""
StrA = StrA & " SELECT YEAR(日期) AS 年份"
StrA = StrA & ",工地名稱"
StrA = StrA & ",IIF(ISNULL(方量)=TRUE,0,方量) as 方量"
StrA = StrA & ",IIF(ISNULL(金額)=TRUE,0,金額)-IIF(ISNULL(已付款)=TRUE,0,已付款) AS 欠款"
StrA = StrA & ",日期"
StrA = StrA & ",業(yè)務員,備注"
StrA = StrA & " FROM [混凝土銷售明細$]"
StrA = StrA & " WHERE NOT [工地名稱] IS NULL AND LEN(工地名稱)>0"
StrSQL = ""
StrSQL = StrSQL & " SELECT 0 AS 序號,年份,業(yè)務員,工地名稱"
StrSQL = StrSQL & ",方量合計,欠款金額,開始打灰時間"
StrSQL = StrSQL & ",NULL AS 備注"
StrSQL = StrSQL & " FROM ("
StrSQL = StrSQL & " SELECT 年份,工地名稱,業(yè)務員"
StrSQL = StrSQL & ",SUM(方量) AS 方量合計"
StrSQL = StrSQL & ",SUM(欠款) AS 欠款金額"
StrSQL = StrSQL & ",MIN(日期) AS 開始打灰時間"
StrSQL = StrSQL & ",1 AS 排序A,1 AS 排序B,2 AS 排序C"
StrSQL = StrSQL & " FROM (" & StrA & ")"
StrSQL = StrSQL & " GROUP BY 年份,工地名稱,業(yè)務員"
StrSQL = StrSQL & " UNION ALL "
StrSQL = StrSQL & " SELECT 年份,'小計' AS 工地名稱,業(yè)務員"
StrSQL = StrSQL & ",SUM(方量) AS 方量合計"
StrSQL = StrSQL & ",SUM(欠款) AS 欠款金額"
StrSQL = StrSQL & ",MIN(日期) AS 開始打灰時間"
StrSQL = StrSQL & ",1 AS 排序A,2 AS 排序B,2 AS 排序C"
StrSQL = StrSQL & " FROM (" & StrA & ")"
StrSQL = StrSQL & " GROUP BY 年份,業(yè)務員"
StrSQL = StrSQL & " UNION ALL "
StrSQL = StrSQL & " SELECT 年份,'年度合計' AS 工地名稱,'年度合計' AS 業(yè)務員"
StrSQL = StrSQL & ",SUM(方量) AS 方量合計"
StrSQL = StrSQL & ",SUM(欠款) AS 欠款金額"
StrSQL = StrSQL & ",MIN(日期) AS 開始打灰時間"
StrSQL = StrSQL & ",3 AS 排序A,2 AS 排序B,3 AS 排序C"
StrSQL = StrSQL & " FROM (" & StrA & ")"
StrSQL = StrSQL & " GROUP BY 年份"
StrSQL = StrSQL & " UNION ALL "
StrSQL = StrSQL & " SELECT '總計' AS 年份,'總計' AS 工地名稱,'總計' AS 業(yè)務員"
StrSQL = StrSQL & ",SUM(方量) AS 方量合計"
StrSQL = StrSQL & ",SUM(欠款) AS 欠款金額"
StrSQL = StrSQL & ",MIN(日期) AS 開始打灰時間"
StrSQL = StrSQL & ",5 AS 排序A,5 AS 排序B,5 AS 排序C"
StrSQL = StrSQL & " FROM (" & StrA & ")"
StrSQL = StrSQL & ") ORDER BY 年份,排序A,業(yè)務員,排序B,排序C,開始打灰時間"
SQLARR = GET_SQL_To_Arr(StrSQL, Str_coon, False)
總結(jié)
以上是生活随笔為你收集整理的vba搜索java里面的sql_在EXCEL中使用SQL语句查询集锦-持续更新中,敬请关注的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: centos6查看java命令_cent
- 下一篇: 怎么装原版win7系统 安装正版WIN7