当前位置:  开发笔记 > 数据库 > 正文

SQL Server hangs querying 2 independent tables

如何解决《SQLServerhangsquerying2independenttables》经验,为你挑选了1个好方法。

I am querying 2 independent tables but related data.

The query is as follows:

select 
    STDEV(M1.[Close]) as M1, STDEV(M2.[Close]) as M2 
from 
    M1, M2;

I want to show 2 standard deviation data on separate columns.

But SQL Server hangs there and stops moving. Why is that? It is a very simple query.

How can I do so without crossing 2 tables? The tables are huge.



1> Serkan Arsla..:

you can use this.

 SELECT 
   (SELECT STDEV(M1.[Close]) from M1) as M1 , 
   (SELECT STDEV(M2.[Close]) from M2) as M2;

推荐阅读
手机用户2402851335
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有