我有一个SQL语句,我从vb中的访问数据库中进行选择,但是我得到了这个错误; “当我运行程序时,查询表达式中的语法错误选择sum(bring_qtty)”。我想我正在做正确的事,但似乎不是。我该如何调整此选择?代码如下:
"select distinct(brought_price) as [Price], select sum(brought_qtty) as [Ordinary] from brought_coffee where " & _
"coffee_grade=O, select sum(brought_qtty) as [Premium] from brought_coffee where" & _
"coffee_grade=P, sum(brought_qtty) as [Total Qtty]" & _
", sum(brought_paid) as [paid], " & _
"sum(brought_bal) as [Balance]" & _
"from brought_coffee, farmer where brought_date=#" & dtc.Text.Trim & "# and farmer_centre='" & cc.Text.Trim & _
"' and farmer.farmer_num=brought_coffee.farmer_num"
答案 0 :(得分:2)
查询中的第二个和第三个select
会产生语法错误...仅使用select sum(brought_qtty)
替换sum(brought_qtty)
。