Using Row_number() function

Note: please leave bug reports and feature requests on

Using Row_number() function

Postby karthick ganeshraman » Tue Nov 24, 2015 6:34 am

Hi,

Im trying to use the row_number() SQL function to partition a table using a particular column, ordering it in descending and pick the first row as the resultant. Below is the query i used

Select * from
(
(Select Col_name1, Col_name2,
Row_number() over (Partition by Col_name3 order by Col_name4 desc)r
from table1)
) where r = 1

But i get the SQL error 42000 (Systax error)

Is there anything that needs to be amended in the syntax ? The same query with the above syntax works correctly in Oracle toad
or
Is there any plugin that need to be added in order for the above function to work ?

Kindly help
karthick ganeshraman
 
Posts: 2
Joined: Tue Nov 24, 2015 6:20 am

Re: Using Row_number() function

Postby smcleod » Wed Nov 25, 2015 4:26 pm

Last edited by smcleod on Tue Dec 01, 2015 4:43 pm, edited 1 time in total.
smcleod
 
Posts: 9
Joined: Fri Jul 31, 2015 6:25 pm

Re: Using Row_number() function

Postby karthick ganeshraman » Thu Nov 26, 2015 6:11 am

Hi,

Thanks for the Info.

I tried the way that you have suggested by using the inner select.

But the result is still the same. I get the 42000 error

Thanks
karthick ganeshraman
 
Posts: 2
Joined: Tue Nov 24, 2015 6:20 am


Return to Support



Who is online

Users browsing this forum: No registered users and 15 guests