以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  sql  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=98895)

--  作者:刘林
--  发布时间:2017/4/8 21:26:00
--  sql
Dim school As String = User.Group
If user.IsRole("区业务主管")
e.Form.Controls("label1").text = "中考信息统计"
Else
e.Form.Controls("label1").text = school & "中考信息统计"
End If

Dim lbl As WinForm.Label = e.Form.Controls("Label1")
If e.Form.width > lbl.Width
    lbl.Left = (e.Form.width - lbl.Width ) / 2
   End If
Dim t As Table = e.Form.controls("Table2").Table
If user.IsRole("区业务主管")
t.Fill("sele ct xxmc,bjdm, (se lect count(*) from {中考表} as b where a.xxmc=b.xxmc and a.bjdm=b.bjdm as 人数, (Sele ct count(*) from {中考表} As b where a.xxmc=b.xxmc And a.bjdm=b.bjdm And xb=\'1\') as 男,(sel ect count(*) from {中考表} as b where a.xxmc=b.xxmc and a.bjdm=b.bjdm and xb=\'2\') as 女, (sel ect count(*) from {中考表} as b where a.xxmc=b.xxmc and a.bjdm=b.bjdm and hklb=\'1\') as 农业户口, (sel ect count(*) from {中考表} as b where a.xxmc=b.xxmc and a.bjdm=b.bjdm and hklb=\'2\') as 非农业户口 from (sel ect xxmc,bjdm from {中考表} group by xxmc,bjdm) as a", "180.153.1 08.50", True)
End If
t.sort = "xxmc,bjdm"
For Each c As Col In t.Cols
    If c.IsNumeric Then
        c.GrandTotal = True
    End If
Next
t.GrandTotal = True 
t.AutoSizeCols()

sql语法错误,老师,对sql语句不懂,照到改了一个统计,提示错误,请问是哪里有误




--  作者:有点色
--  发布时间:2017/4/9 10:48:00
--  

在sql测试窗口单独测试你的sql语句,看报什么错,然后删减sql语句确定出错位置。

 

http://www.foxtable.com/webhelp/scr/1484.htm