0
Hello Ramco,
To display Row Numbers that reset for each G/L Account, use the ROW_NUMBER()
function with PARTITION BY
.
SELECT
ROW_NUMBER() OVER (PARTITION BY [G/l Account] ORDER BY [G/l Account]) AS [Row Number],
[G/l Account],
Debit,
Credit
FROM Masters;
Good Luck!
0
Hi! To display row numbers in SQL, you can use the ROW_NUMBER() function. This function assigns a unique sequential integer to each row within a partition of a result set.
Here is an example SQL query that demonstrates how to display row numbers based on your provided data:
SELECT
ROW_NUMBER() OVER (ORDER BY [G/l Account]) AS RowNumber,
[G/l Account],
Debit,
Credit
FROM
YourTableName
Replace `YourTableName` with the actual name of your table where this data is stored. By using the `ROW_NUMBER() OVER (ORDER BY [G/l Account])` clause, you assign row numbers based on the order of the G/l Account.
This query will generate row numbers for each row in the result set, allowing you to uniquely identify each row. Let me know if you need further assistance or have any other questions!