[SQL Server Experience] DeriveDTBL usage

xiaoxiao2021-03-06  18

There is such a sentence, executing unsuccessful

SELECT Count (*) AS EXPR1 from (SELECT Visitor_ip from visitor where visitor_requesttime> 2005/03/28 ') Group by visitor_ip) DerivedTBL

Returning an error

Server: Message 156, Level 15, State 1, Row 1 There is a syntax error near the keyword 'group'.

After the change, the sentence is

Select Count (*) AS EXPR1FROM (SELECT VITOR_IP FROM (SELECT VITOR_IP FROM (SELECT VITOR_IP from Visitor Where Visitor_RequestTime> '2005/03/28') DerivedTBL Group by visitor_ip) DerivedTBL

execution succeed

Cause Analysis:

Just join the DeriveDTBL keyword as long as you perform the picking operation from the result set.

(The company's master said, the specific thing is not clear, this keyword can not be found in the online series.)

This place is clear, it is really an alias.

Thanks to the guidance of cxlfly, thank you.

转载请注明原文地址:https://www.9cbs.com/read-41505.html

New Post(0)