I have a table tbl_entso_cdbf
with some values as shown below. I want to perform some operations on this table. I do not know why this simple query fails to perform row_number() operation.
This is a query I am using:
SELECT
ROW_NUMBER() OVER (PARTITION BY utc ORDER BY value) AS row_num,
pk, area_in, area_out
from tbl_entso_cdbf;
It gives some wierd error to check the syntax near '(Partition by utc order by value) AS row_num, pk, area_in, area_out....
I digged a lot but I have no clue about this error (https://mariadb.com/kb/en/mariadb/row_number/)
(http://www.c-sharpcorner.com/blogs/rownumber-function-with-partition-by-clause-in-sql-server1)(https://learn.microsoft.com/en-us/sql/t-sql/functions/row-number-transact-sql). I need to perform further sql operations to filter a big table but couldn't move because this errors.
pk | Utc | date |area_in|area_out| value |
-----------------------------------------------------------------------
1 | 2015-12-05T03:00Z |2015-12-05 03:00:00| 275 | 40 | 320 |
2 | 2015-12-05T03:00Z |2015-12-05 03:00:00| 40 | 275 | 0 |
3 | 2015-12-06T03:00Z |2015-12-06 03:00:00| 100 | 175 | 550 |
4 | 2015-12-06T03:00Z |2015-12-06 03:00:00| 175 | 100 | 0 |
5 | 2015-11-04T03:00Z |2015-11-04 03:00:00| 280 | 310 | 0 |
6 | 2015-11-04T03:00Z |2015-11-04 03:00:00| 310 | 280 | 0 |
7 | 2016-09-19T00:00Z |2016-09-19 00:00:00| 187 | 292 | 45 |
8 | 2016-09-19T00:00Z |2016-09-19 00:00:00| 292 | 187 | 0 |