SQL Error with Order By in Subquery

Posted by cagin on Stack Overflow See other posts from Stack Overflow or by cagin
Published on 2009-06-12T09:56:35Z Indexed on 2010/03/13 4:55 UTC
Read the original article Hit count: 229

Filed under:

Hi all. i m working sql server 2005.

My query is:

SELECT (
SELECT COUNT(1) FROM Seanslar WHERE MONTH(tarihi) = 4
GROUP BY refKlinik_id
ORDER BY refKlinik_id) as dorduncuay

And the error: The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.

How can i use order by in a sub query?

© Stack Overflow or respective owner

Related posts about sql-server