一个SQL语句的问题,总是编译过,请大家给看一下

roro0311 2005-03-28 03:55:04
SELECT rkdname.ywid AS ywid,"+
    "rkdname.ljno As ljno,"+
    "rkdname.units AS units,"+
    "rkdname.bzsname AS bzsname,"+
"rkdname.spint AS spint,"+
"rkdname.zj AS zj,"+
"rkdname.adddate AS adddate,"+
"rkdname.sgov AS sgov,"+
"rkdname.invoice_no AS invoice_no"+
"rkdname.invoice_date AS invoice_date,"+
"ie.GR_NO AS gr_no,"+
"ie.BILL_NO AS bill_no,"+
"ie.IN_DATE AS in_date,"+
"bgd.mxdno AS mxdno,"+
"bgd.bgdh AS bgdh,"+
"bgd.zch AS zch "+
"FROM ie_gr ie,(SELECT * FROM "+table[i][0]+" WHERE id IN "+
"(SELECT id FROM YWList WHERE typeid="+typeid+" AND status=3)) rkdname,"+
"LEFT JOIN BGD_ZC_MX bgd ON bgd.ywid=rkdname.ywid "+
"WHERE ie.INVOICE_NO=rkdname.INVOICE_NO"+
" AND rkdname.INVOICE_NO IN (select INVOICE_NO from ie_gr)"+
" AND ie.LJNO<>rkdname.LJNO"+
" AND ie.QUANTITY<>rkdname.spint"+
" AND ie.AMOUNT<>rkdname.zj"+
" AND ie.CURR<>rkdname.bzsname"+
" AND ie.COUNTRY<>rkdname.sgov"+
" AND ie.UNIT<>rkdname.units";
...全文
129 点赞 收藏 8
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
hcw_peter 2005-03-29
"rkdname.invoice_no AS invoice_no"+
少了个逗号。
这段sql运行起来效率不回太高,用了两个in语句。
其实可以整合一下,把最后那个in中的sql用关联的方式,会快一些。
回复
韩嵩峰 2005-03-29
顶!!!!
回复
linhao315 2005-03-29
SELECT rkdname.ywid AS ywid,"+ 少了引号"
应为:
SELECT "rkdname.ywid AS ywid,"+
回复
alpha15 2005-03-29
"rkdname.invoice_no AS invoice_no********************"+
"rkdname.invoice_date AS invoice_date,"+
回复
wenchaohu213 2005-03-29
语句一条一条的执行,

就知道问题到底是处在哪一条的语句上面了
回复
wcmj 2005-03-29
"rkdname.invoice_no AS invoice_no"+ 少了","
回复
silverend 2005-03-28
语法细节得小心
回复
lydong 2005-03-28
把SQL打印出来,在数据库命令行窗口执行,用排他法逐步确定错误原因

?错误代码
回复
相关推荐
发帖
Java EE
创建于2007-09-28

6.6w+

社区成员

J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
申请成为版主
帖子事件
创建了帖子
2005-03-28 03:55
社区公告
暂无公告