所以我试图在我的sql server数据库上运行这个查询:
from multiprocessing import Process
import os
import time
def sleeper(name, seconds):
print "Sub Process %s ID# %s" % (name, os.getpid())
print "Parent Process ID# %s" % (os.getppid())
print "%s will sleep for %s seconds" % (name, seconds)
time.sleep(seconds)
if __name__ == "__main__":
child_proc = Process(target=sleeper, args=('bob', 5))
child_proc.start()
time.sleep(2)
child_proc.terminate()
#child_proc.join()
#time.sleep(2)
#print "in parent process after child process join"
#print "the parent's parent process: %s" % (os.getppid())
我收到此错误消息:“Msg 102,Level 15,State 1,Line 5''''附近的语法不正确。”
我已经确认此查询本身可以正常工作:
SELECT MAX(timestamp)
FROM (SELECT TOP (20) timestamp
FROM CPPM_03ChannelCountErrors
WHERE '2015-03-10 00:00:00' < timestamp AND timestamp < '2015-03-15 00:00:00' AND skuid = '3252'
ORDER BY timestamp)
如果有人知道这一点我很感激。这让我疯了
答案 0 :(得分:1)
outerHTML
每个子查询都需要一个别名。我添加了它,并将其命名为SELECT MAX(timestamp)
FROM
(
SELECT TOP (20) timestamp
FROM CPPM_03ChannelCountErrors
WHERE '2015-03-10 00:00:00' < timestamp
AND timestamp < '2015-03-15 00:00:00'
AND skuid = '3252'
ORDER BY timestamp
) tmp
答案 1 :(得分:0)
SELECT MAX(timestamp)
FROM (SELECT TOP (20) timestamp
FROM CPPM_03ChannelCountErrors
WHERE '2015-03-10 00:00:00' < timestamp
AND timestamp < '2015-03-15 00:00:00' AND skuid = '3252'
ORDER BY timestamp) t --<-- you need to alias the sub-query here