Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I written the query

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 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


XML
<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!=&#39;&#39; 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
Posted

1 solution

Try changing:
SQL
and Column5=1 and Row_Number between 7 and 12 and
To
SQL
and Column5=1 and c.Row_Number between 7 and 12 and
 
Share this answer
 
Comments
Member 10226004 17-Jun-14 2:04am    
still getting the same error this column is created in query which is not exist in the two tables

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900