如何使用之间的查询获得结果 [英] how to get the results from below query using between
本文介绍了如何使用之间的查询获得结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写的查询
< pre lang =sql> SELECT ROW_NUMBER() OVER ( ORDER BY 计数(*) DESC ) AS [Row_Number],t.Column1,c.Column2,count(*) as 从<计算 表1 as c,表2 as t 其中 t.column3 类似 c.cloumn2 和 Column5 = 1 和 t.column2!= ' ' group by c.Column2,t.column1
得到将Row_Number列作为自动增量计算结果,但现在我想在下面的查询之间使用Row_Number列
< pre < span class =code-attribute> lang = sql > SELECT ROW_NUMBER()OVER(ORDER BY Count(*)DESC)AS [Row_Number],t.Column1,c.Column2,count(*)作为来自Table1的计数为c,表2为t其中t.column3类似于c.cloumn2和Column5 = 1,Row_Number介于7和12之间,而t.column2!=&#39;&#39; group by c.Column2,t.column1 < / pre >
但是Row_Number正在显示错误,如不是有效的cloumn,请告诉我修改工作与
解决方案
尝试更改:
和 Column5 = 1 和 Row_Number 7 和 12 和要
和 Column5 = 1 和 c.Row_Number 7 和 12 和跨度>
Hi,
I written the query
SELECT ROW_NUMBER() OVER (ORDER BY Count(*) DESC) AS [Row_Number],t.Column1,c.Column2,count(*) as Counts from Table1 as c,Table2 as t where t.column3 Like c.cloumn2 and Column5=1 and t.column2!='' group by c.Column2,t.column1
am getting the results with column Row_Number as Auto Increment but now i want to use the Row_Number Column as between below query
<pre lang="sql">SELECT ROW_NUMBER() OVER (ORDER BY Count(*) DESC) AS [Row_Number],t.Column1,c.Column2,count(*) as Counts from Table1 as c,Table2 as t where t.column3 Like c.cloumn2 and Column5=1 and Row_Number between 7 and 12 and t.column2!='' group by c.Column2,t.column1</pre>
but Row_Number is showing error like not a valid cloumn,please tell me modifications to work with between
解决方案
Try changing:
and Column5=1 and Row_Number between 7 and 12 andTo
and Column5=1 and c.Row_Number between 7 and 12 and
这篇关于如何使用之间的查询获得结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文