SQL问题(在关键字 'SELECT' 附近有语法错误)

SELECTA.*,D.*FROMBK_HEADERAWITH(NOLOCK)LEFTJOIN(SELECTC.BK_NO_ID,SUM(CASEWHENLEFT(C.C... SELECT A.*,D.*
FROM BK_HEADER A WITH (NOLOCK)
LEFT JOIN
(
SELECT
C.BK_NO_ID,
SUM(CASE WHEN LEFT(C.CONTAINER_TYPE,1)='2' and C.CONTAINER_TYPE<>'20RF' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T20,
SUM(CASE WHEN C.CONTAINER_TYPE='20RF' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T20RF,
SUM(CASE WHEN LEFT(C.CONTAINER_TYPE,1)='4' AND C.CONTAINER_TYPE<>'40HC' AND C.CONTAINER_TYPE<>'40RH'AND C.CONTAINER_TYPE<>'40RF' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T40,
SUM(CASE WHEN C.CONTAINER_TYPE='40HC' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T40HC,
SUM(CASE WHEN C.CONTAINER_TYPE='40RH' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T40RH,
SUM(CASE WHEN LEFT(CONTAINER_TYPE,1)='2' THEN ISNULL(C.QUANTITY,0) ELSE 2*ISNULL(C.QUANTITY,0) END) AS TEU
FROM BK_REQUEST_EQUIPMENTS C WITH (NOLOCK)
GROUP BY C.BK_NO_ID
)AS D
服务器: 消息 156,级别 15,状态 1,过程 IBConigneeList,行 8
在关键字 'SELECT' 附近有语法错误。
这是怎么回事
select A*,D*那边
展开
 我来答
百度网友5c91d28
2008-03-27 · TA获得超过5084个赞
知道大有可为答主
回答量:1916
采纳率:50%
帮助的人:1684万
展开全部
left join必须加上ON字句指定连接条件
如果闭野乱A和D没有关联条件,那就这么写
SELECT A.*,D.*
FROM BK_HEADER A WITH (NOLOCK)
LEFT JOIN
(
SELECT
C.BK_NO_ID,
SUM(CASE WHEN LEFT(C.CONTAINER_TYPE,1)='2' and C.CONTAINER_TYPE<>'20RF' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T20,
SUM(CASE WHEN C.CONTAINER_TYPE='20RF'轿档 THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T20RF,
SUM(CASE WHEN LEFT(C.CONTAINER_TYPE,1)='4' AND C.CONTAINER_TYPE<>'40HC' AND C.CONTAINER_TYPE<>'40RH'AND C.CONTAINER_TYPE<>'40RF'脊码 THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T40,
SUM(CASE WHEN C.CONTAINER_TYPE='40HC' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T40HC,
SUM(CASE WHEN C.CONTAINER_TYPE='40RH' THEN ISNULL(C.QUANTITY,0) ELSE 0 END) AS T40RH,
SUM(CASE WHEN LEFT(CONTAINER_TYPE,1)='2' THEN ISNULL(C.QUANTITY,0) ELSE 2*ISNULL(C.QUANTITY,0) END) AS TEU
FROM BK_REQUEST_EQUIPMENTS C WITH (NOLOCK)
GROUP BY C.BK_NO_ID
)AS D
ON 1=1
中淑巢弼
2019-09-02 · TA获得超过4368个赞
知道大有可为答主
回答量:3144
采纳率:28%
帮助的人:201万
展开全部
这样可以绑亏亏定吗不能先答没把"select
ID
From
SQL
where
ID='100'"这部分数据读出来
DataSet/Table再绑定到Adodc1.RecordSource上吗?直接绑定我还没使用过可以咧VB语言貌似不销举神是这样写的吧建议
一步一个脚印别太急了!~~
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式