这条sql语句错在哪里,谢谢(10分)

  • 主题发起人 devexpress
  • 开始时间
D

devexpress

Unregistered / Unconfirmed
GUEST, unregistred user!
select * into #temp from
(
select type as 类型,gysname as 供应商名称,jhdh as 单号,ze as 总额,xmoney as 进项税额,zexmoney as 价税合计
from
(
select A.password,'采购进货' as type,C.gysname As gysname,A.jhdh,B.ze as ze,B.xmoney as xmoney,B.zexmoney as zexmoney, 2 as OrderType
From jhdb A,

order by password,OrderType
))


//Server: Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'order'.
这是什么错误
 
From jhdb A,
order by password,OrderType
多了,
 
order by 前面有一个逗号
 
From jhdb A,
多了个逗号
 
表B好象未定义,Order前多了一个逗号
 
谢谢各位,但还是出错,Server: Msg 1033, Level 15, State 1, Line 7
An ORDER BY clause is invalid in views, derived tables, and subqueries unless TOP is also specified.


select * into #temp1 from (
select A.jhdh,A.gysbh,A.yfmoney,A.ytmoney,B.money from jhdb A,
(select jhdh,sum(dj*sl+(dj*sl*xl)/100) as money from jhmxb group by jhdh) B

where (A.jhdh=B.jhdh) and (isnull(A.yfmoney,0)+isnull(A.ytmoney,0)<> isnull(B.money,0))
order by j.jhdh //加了这句,如果没加就正确
) d
 
我找到问题所在了。谢谢大家。


) d
order by j.jhdh //加了这句,如果没加就正确

写到外面来
 
多人接受答案了。
 
顶部