I have a table with the info about buildings, a table about expenses, a table about users and a table that does the billing. In the billing table, I need to have a counter that counts different users inside a building. I tried to do this with the ROW_NUMBER() but I can't get the desired result.
This is my query so far:
This is my output:
What I would want to get is this:
For every user inside a building, counter+1.
Seems like you would have to use DENSE_RANK instead of ROW_NUMBER(). In the following code I have added the counter per building as well as counter per user, use whatever suits you
Hope it helps. Cheers.
answered Feb 08 at 11:52 AM