Hi
I have as issue with this rownum.This is supported in different forms in different databases like top in mssql ,limit in mysql and all..i want to genaralise this independent of the type of database because i want to run the query as i wont be knowing the type of the DB used by my user.
can anyone suggest a solution for this ? is there anyway of generating a series of numbers with the query by calling the function in that query repetitively ?
Regards
SreenathA UDF won't help you, because not all databases support User Defined Functions.
I think you will need to use something like this, which requires a primary key or unique sort order on your result set:
select a.Pkey, count(*) as RowNum
from YourTable a
inner join YourTable b on a.Pkey >= b.Pkey
group by a.PKey
No comments:
Post a Comment