Hi
I have below Sql Query and i want to display Row Number group by Account
SELECT
A."Account" ,(A."Debit") AS "Debit", (A."Credit") AS "Credit",
From Masters A
order by A."Account"
Thanks
Hi
I have below Sql Query and i want to display Row Number group by Account
SELECT
A."Account" ,(A."Debit") AS "Debit", (A."Credit") AS "Credit",
From Masters A
order by A."Account"
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Muhammad Imran AnsariPosted Mar 26, 2025, 10:25 AM
Hello Ramco,
To display a Row Number grouped by Account, use the
ROW_NUMBER()window function withPARTITION BY.Good Luck!
Emily FosterPosted Mar 26, 2025, 8:13 AM
It appears that you are looking to incorporate row numbers grouped by the "Account" field in your SQL query. One common approach to achieve this is by using the ROW_NUMBER() window function in SQL. Here is how you can modify your query to include row numbers grouped by the "Account":
In this adjusted query, the ROW_NUMBER() function is used alongside the PARTITION BY clause to assign a unique row number to each row within a specific "Account" group. The ORDER BY clause within the ROW_NUMBER function determines the order in which the row numbers are assigned.
By executing this query, you should be able to obtain a result set that includes a row number for each row within the distinct "Account" groups. This can be particularly useful for various analytical and reporting purposes. Feel free to test this query with your data and let me know if you have any further questions or need additional assistance.