hello people,
when i run this below written query then i get error as
"ORDER BY clause is invalid in views,inline functions,derived tables, subqueries and common table expression unless TOP or for Xml is also specified".
i want to have the top 5 result based on the Gross_written_premium .
can someone please help me out as m new to sql server 2005.
please !!!!!
My query is
select dp.product_lob As lobs,
SUM(fs.written_premium_amt_ytd) As Gross_written_premium from
(select
dp.product_lob As lobs,
SUM(fs.written_premium_amt_ytd) As Gross_written_premium
FROM dbo.Fct_Summary as fs
inner join Dim_product as dp on ( fs.product_key = dp.product_key )
inner join Dim_Calendar as dc on ( fs.calendar_key = dc.calendar_key)
where dc.calendar_month_name like $P{Month}
Group by product_lob,
written_premium_amt_ytd
order by SUM(fs.written_premium_amt_ytd) desc)
from
dbo.Fct_Summary as fs
inner join Dim_product as dp on ( fs.product_key = dp.product_key )
inner join Dim_Calendar as dc on ( fs.calendar_key = dc.calendar_key)
where rownum<=5