MSSQL Select statement with incremental integer column… not from a table

For SQL 2005 and up SELECT ROW_NUMBER() OVER( ORDER BY SomeColumn ) AS ‘rownumber’,* FROM YourTable for 2000 you need to do something like this SELECT IDENTITY(INT, 1,1) AS Rank ,VALUE INTO #Ranks FROM YourTable WHERE 1=0 INSERT INTO #Ranks SELECT SomeColumn FROM YourTable ORDER BY SomeColumn SELECT * FROM #Ranks Order By Ranks see … Read more

Find Cell Matching Value And Return Rownumber

Here the code function rowOfEmployee(){ var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var data = sheet.getDataRange().getValues(); var employeeName = sheet.getRange(“C2”).getValue(); for(var i = 0; i<data.length;i++){ if(data[i][1] == employeeName){ //[1] because column B Logger.log((i+1)) return i+1; } } } When you want to perform this kind of lookup it is better to retrieve data with sheet.getDataRange().getValues() because in this … Read more

Oracle ‘Partition By’ and ‘Row_Number’ keyword

PARTITION BY segregate sets, this enables you to be able to work(ROW_NUMBER(),COUNT(),SUM(),etc) on related set independently. In your query, the related set comprised of rows with similar cdt.country_code, cdt.account, cdt.currency. When you partition on those columns and you apply ROW_NUMBER on them. Those other columns on those combination/set will receive sequential number from ROW_NUMBER But … Read more