本文介绍了关键字'as'附近的语法不正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我的sql查询有问题

当我使用

时(选择MsgTable) .ID,MAX(MsgTable.Time)为来自MsgTable组的Ms由MsgTable.ID提供)



我得到了正确的回复

但是当我使用

(选择MsgTable.ID,MAX(MsgTable.Time)作为来自MsgTable组的MsgTable.ID)作为G 



我收到以下错误

消息156,级别15,状态1,行12 
关键字'as'附近的语法不正确。



我想在JOIN声明中使用'G'

请帮我解决这个问题,



我尝试过:



(选择MsgTable.ID ,Ms(MsgTable.Time)由MsgTable.ID作为来自MsgTable组的t)作为G 
解决方案

hi all
I have a problem in my sql query
when I use the

(select MsgTable.ID, MAX(MsgTable.Time) as t from MsgTable group by MsgTable.ID)


I get the correct reply
but when I use

(select MsgTable.ID, MAX(MsgTable.Time) as t from MsgTable group by MsgTable.ID) as G


I get following error

Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'as'.


I want to use 'G' in a JOIN statement
please help me to figure out this ,

What I have tried:

(select MsgTable.ID, MAX(MsgTable.Time) as t from MsgTable group by MsgTable.ID) As G
解决方案


这篇关于关键字'as'附近的语法不正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 01:34