以下是select query的说明..我收到的错误为:
Microsoft OLE DB Provider for ODBC Drivers错误'80040e14' [Microsoft] [ODBC Microsoft Access驱动程序] FROM子句中的语法错误。
Dim DataConn
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "Driver={Driver do Microsoft Access (*.mdb)}; DBQ="& Server.Mappath("db\wsmt.mdb") & ";pwd=openreach;"
Dim Recordset_report
Set Recordset_report = Server.CreateObject("ADODB.Recordset")
Dim sRet
if Request.form("submit1")<>"" then
Recordset_report.Open "Select WP.CR_No as ""Cr No"", WP.WP_ID as""WP ID"", WP_Name as ""WP Name"","&_
" iif(isnull(ow1),' ',ow1+';')+' '+' '+iif(isnull(ow2),' ',ow2+';')+' '+' '+iif(isnull(ow3),' ',ow3+';')+' '+' '+iif(isnull(ow4),' ',ow4+';')+' '+' '+iif(isnull(ow5),' ',ow5) as ""Owner(s)"","&_
"Type as ""WP Type"", Release, Area, Rec_dt as ""Date Started"", Rec_from as ""Requirement Owner"","&_
"TCD,Perc_comp as ""% Completed"", Complexity, Status,Act_close as ""Actual Closed Date"" from wp, "&_
" inner join ( select wp_id,owner1,(select fullname from userinfo where userid=a.owner1) as ow1,owner2,"&_
" (select fullname from userinfo where userid=a.owner2) as ow2,owner3,"&_
" (select fullname from userinfo where userid=a.owner3) as ow3,owner4,"&_
" (select fullname from userinfo where userid=a.owner4) as ow4,owner5,"&_
" (select fullname from userinfo where userid=a.owner5) as ow5 from allocation a) as t,"&_
" on (wp.wp_id = t.wp_id) where Rec_dt >= #"&Request.form("from")&"# and "&_
" Rec_dt <= #"&Request.form("to")&"# and not WP.Disable order by Rec_dt, "&_
" inner join (select tool_est,wp_id from estimation), "&_
" on (wp.wp_id = Estimation.wp_id) where Rec_dt >= #"&Request.form("from")&"# and ,"&_
" Rec_dt <= #"&Request.form("to")&"# and not WP.Disable order by Rec_dt ", DataConn
答案 0 :(得分:3)
你正在做“from wp, inner join
”=&gt;必须删除“,”
在更好地审查之后,你有更多的情况,你暗示“,”你不应该在哪里。试着指出一些,但你应该检查查询。
您需要删除“,”:
as t, on (wp.wp_id = t.wp_id)
另外,在您order by Rec_dt
订购后,您有:
, inner join (select tool_est,wp_id from estimation), on
需要删除内部连接之前的“,”和“内部连接”之前的“,”。另外,在最后一行之前的行中and ,
,应删除此逗号2。
最后,你的最后一次内部联系不应该是它的位置,但我仍然没有得出结论,你真的想要一个内部联接,或者是否应该解决某种联盟。 / p>