Icon

kn_​forum_​26479_​hive_​group_​rank

use Hive to produce a Position / Rank number within a group variable

use Hive to produce a Position / Rank number within a group variable

use Hive to produce a Position / Rank number within a group variablehttps://forum.knime.com/t/help-needed-with-multi-row-formula/26479/5?u=mlauber71 SELECT `t2`.`GroupID` , `t2`.`Previous`, `t2`.`Next`, `t2`.`Id`, `t2`.`Position` FROM-- start t2( SELECT * , ROW_NUMBER() OVER (-- set which column should be the one within to calculate the rank / position PARTITION BY `t1`.`GroupID` -- set rules which how tto sort the data within the group ID / partition-- NULLS could be counted LAST or FIRST ORDER BY `t1`.`Previous` ASC NULLS FIRST , `t1`.`Id` ASC NULLS FIRST , `t1`.`Next` ASC NULLS FIRST ) AS `Position`FROM #table# AS `t1`) `t2`-- end t2ORDER BY `t2`.`Position` , `t2`.`Id` , `t2`.`Next` , `t2`.`Previous` knime://knime.workflow/data_source.xlsxdata_alldata_allalternative: SQL Executor withDROP TABLE IF EXISTS default.data_all;=> deletes the wholelocal big data folderdata/local_big_dataif you encouter any problems, closeKNIME and delete all data from the folder/data/local_big_data/the Query that produces thePosition grouped by IDresultknime://knime.workflow/data_result.xlsx Excel Reader (XLS) DB Table Creator DB Loader DB Table Remover local big datacontext create DB Query DB Reader Excel Writer (XLS) use Hive to produce a Position / Rank number within a group variablehttps://forum.knime.com/t/help-needed-with-multi-row-formula/26479/5?u=mlauber71 SELECT `t2`.`GroupID` , `t2`.`Previous`, `t2`.`Next`, `t2`.`Id`, `t2`.`Position` FROM-- start t2( SELECT * , ROW_NUMBER() OVER (-- set which column should be the one within to calculate the rank / position PARTITION BY `t1`.`GroupID` -- set rules which how tto sort the data within the group ID / partition-- NULLS could be counted LAST or FIRST ORDER BY `t1`.`Previous` ASC NULLS FIRST , `t1`.`Id` ASC NULLS FIRST , `t1`.`Next` ASC NULLS FIRST ) AS `Position`FROM #table# AS `t1`) `t2`-- end t2ORDER BY `t2`.`Position` , `t2`.`Id` , `t2`.`Next` , `t2`.`Previous` knime://knime.workflow/data_source.xlsxdata_alldata_allalternative: SQL Executor withDROP TABLE IF EXISTS default.data_all;=> deletes the wholelocal big data folderdata/local_big_dataif you encouter any problems, closeKNIME and delete all data from the folder/data/local_big_data/the Query that produces thePosition grouped by IDresultknime://knime.workflow/data_result.xlsxExcel Reader (XLS) DB Table Creator DB Loader DB Table Remover local big datacontext create DB Query DB Reader Excel Writer (XLS)

Nodes

Extensions

Links