Foxtable(狐表)用户栏目专家坐堂 → sql报错


  共有2016人关注过本帖树形打印复制链接

主题:sql报错

帅哥哟,离线,有人找我吗?
home8225
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:169 积分:1678 威望:0 精华:0 注册:2014/3/27 16:44:00
sql报错  发帖心情 Post By:2017/12/19 19:15:00 [只看该作者]

提示AS附近有语法错误*3,求助。。。。。。

se lect * from (Sel ect [ITEM_ID] as [主件ID],[ITEM_CODE] as [主件品号],[ITEM_NAME] as [主件品名],[SHORTCUT] as [主件材质],[ITEM_SPECIFICATION] as [主件规格],[DRAWING_NO] as [主件图号],[BOM_ID] From {BOM} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM}.[ITEM_ID] AS {A}) inner join (Se lect [SOURCE_ID_ROid],[ITEM_CODE] as [元件品号],[ITEM_NAME]as [元件品名],[SHORTCUT] as [元件材质],[ITEM_SPECIFICATION]as [元件规格],[DRAWING_NO]as [元件图号],[BOM_ID] From {BOM_D} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM_D}.[SOURCE_ID_ROid] AS {B}) on {A}.[BOM_ID] ={B}.[BOM_ID] left join (Sel ect round(avg([UNIT_COST]),2) as [采购均价],[ITEM_ID] From {INV_UNIT_COST} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {INV_UNIT_COST}.[ITEM_ID] Where datediff(year,[ACCOUNT_YEAR],getdate())=0 Group By [ITEM_ID] AS {C}) on {C}.[ITEM_ID]= {B}.[[SOURCE_ID_ROid]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/12/19 20:33:00 [只看该作者]

 as 后面的别名不需要大括号。另外位置不对

se lect * from (Sel ect [ITEM_ID] As [主件ID],[ITEM_CODE] As [主件品号],[ITEM_NAME] As [主件品名],[SHORTCUT] As [主件材质],[ITEM_SPECIFICATION] As [主件规格],[DRAWING_NO] As [主件图号],[BOM_ID] From {BOM} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM}.[ITEM_ID]) as a inner join (Se lect [SOURCE_ID_ROid],[ITEM_CODE] As [元件品号],[ITEM_NAME]As [元件品名],[SHORTCUT] As [元件材质],[ITEM_SPECIFICATION]As [元件规格],[DRAWING_NO]As [元件图号],[BOM_ID] From {BOM_D} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM_D}.[SOURCE_ID_ROid]) as b on A.[BOM_ID] =B.[BOM_ID] left join (Sel ect round(avg([UNIT_COST]),2) As [采购均价],[ITEM_ID] From {INV_UNIT_COST} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {INV_UNIT_COST}.[ITEM_ID] Where datediff(year,[ACCOUNT_YEAR],getdate())=0 Group By [ITEM_ID]) as c on C.[ITEM_ID]= B.[[SOURCE_ID_ROid]


 回到顶部
帅哥哟,离线,有人找我吗?
home8225
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:169 积分:1678 威望:0 精华:0 注册:2014/3/27 16:44:00
  发帖心情 Post By:2017/12/20 10:30:00 [只看该作者]

谢谢~!

 回到顶部
帅哥哟,离线,有人找我吗?
home8225
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:169 积分:1678 威望:0 精华:0 注册:2014/3/27 16:44:00
  发帖心情 Post By:2017/12/20 10:44:00 [只看该作者]

全面报错???提示修改了只读数据.......

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20171220104349.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/12/20 10:49:00 [只看该作者]

试试,去掉提示。

 

Dim dt = DataTables("表A").basetable
For Each r As object In dt.rows
    For Each c As object In dt.columns
        r.SetColumnError(c.tostring, "")
    Next
    r.RowError = ""
Next


 回到顶部
帅哥哟,离线,有人找我吗?
home8225
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:169 积分:1678 威望:0 精华:0 注册:2014/3/27 16:44:00
  发帖心情 Post By:2017/12/20 11:35:00 [只看该作者]

谢谢,已经解决了,是sql加载列有问题图片点击可在新窗口打开查看

 回到顶部