我有更多代码,但这是重要的一点。其余部分是JS函数和样式。
<button onClick="gB()" id="gb"> clickme</button>
<script src="jquery-1.12.2.min.js">
$( document ).ready(function() {
$('button').eq(0).trigger('click');
};
答案 0 :(得分:5)
您无法将 create table table_A(
id int,
name varchar(25),
dayA int,
monthA int,
yearA int,
x int
)
insert into table_A
values (1,'name1',2,3,2016,4),
(2,'name2',2,3,2016,3),
(2,'name1',2,3,2016,2)
select ta.id, ta.name, ta.dayA, ta.monthA, ta.yearA, ta.x, total.Total from table_A as ta
left join
(select name, sum(x) as Total from table_A group by name) total on ta.name = total.name
group by
ta.id, ta.name, ta.dayA, ta.monthA, ta.yearA, ta.x, total.name, total.Total
标记与<script>
和内部脚本混合在一起。制作两个标签
src
此外,在开发时检查您的控制台。它会为你指出错误。
答案 1 :(得分:3)
因为您忘记了在最后一行关闭括号strSQLString = "SELECT tblExportCost.ProjDef, tblExportCost.Year,\n"
+ "Sum(IIf([Per]=1,[Val/ObjCur],0.0)) AS Jan, Sum(IIf([Per]=2,[Val/ObjCur],0.0)) AS Feb, Sum(IIf([Per]=3,[Val/ObjCur],0.0)) AS Mar,\n"
+ "Sum(IIf([Per]=4,[Val/ObjCur],0.0)) AS Apr, Sum(IIf([Per]=5,[Val/ObjCur],0.0)) AS May, Sum(IIf([Per]=6,[Val/ObjCur],0.0)) AS Jun,\n"
+ "Sum(IIf([Per]=7,[Val/ObjCur],0.0)) AS Jul, Sum(IIf([Per]=8,[Val/ObjCur],0.0)) AS Aug, Sum(IIf([Per]=9,[Val/ObjCur],0.0)) AS Sep,\n"
+ "Sum(IIf([Per]=10,[Val/ObjCur],0.0)) AS Oct, Sum(IIf([Per]=11,[Val/ObjCur],0.0)) AS Nov, Sum(IIf([Per]=12,[Val/ObjCur],0.0)) AS Dec\n"
+ "FROM tblExportCost\n"
+ "GROUP BY tblExportCost.ProjDef, tblExportCost.Year\n"
+ "HAVING (((tblExportCost.Year)= '" + strYear + "') AND ((tblExportCost.ProjDef)= 'T3415" + strNumber + "'))";
。
)
您有基本的语法错误。始终检查控制台是否有任何错误/异常。 +谷歌一些基本的教程如何从jQuery等开始。