嵌套的sql语句出现错误
Dim conn As ADODB.ConnectionDim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=IP地址;uid=root;pwd=;database=数据库名"
conn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseServer
rs.Open "SELECT bb.OrderNo AS aaa, bb.Style AS bbb, Sum(bb.a) AS ccc" _
& " FROM [SELECT pywrkord.OrderNo,pywrkord.Style, Count(pypeidui.RegDate) as a FROM pywrkord INNER JOIN pypeidui ON pywrkord.WrkOrder = pypeidui.WrkOrder where pywrkord.OrderNo='11FR-168' and pywrkord.Style='801129/A' GROUP BY pywrkord.OrderNo, pywrkord.Style]. AS [bb] GROUP BY bb.OrderNo, bb.Style", conn
用上面的语句连接mysql数据库,在RS.OPEN处出现了错误提示(如图所示),这段sql语句的是嵌套得到的。
请帮我看看是哪里的问题。
谢谢!