Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL to get new users month on month from a table

Ryansun-Oracle6 days ago

Hi All,

I have a table in the following format

create table app_access

(id number primary key,

useremail varchar2(200),

logged_in date);
insert into app_access values(1, 'jon.doe@oracle.com',sysdate);
date);

insert into app_access values(1, 'jon.doe@oracle.com',sysdate);
date);

insert into app_access values(1, 'jon.doe@oracle.com',sysdate-1);
date);

insert into app_access values(1, 'jon.sham@oracle.com',sysdate);

I was trying to think of a way to build a SQL where say for a given year(2025) for January- 25 it shows me all the new users, assuming thats the first time everyone logged in. There after, for February-25, it would show me all the new logged in users and not consider the existing users. As in if the users from January login in February, they will not be considered. Similarly all the way till December. From a functional standpoint getting new users that accessed the system every month. Is something like this even possible?

So Output would be something like

Jan-25 - 2 distinct users

Feb -25. - 5 distinct users

Mar - 25. - 1 new user

Dec-25 - 12 new users.

Any idea if this is possible?

Thanks!

This post has been answered by Gerrit van der Linden on Oct 25 2025
Jump to Answer
Comments
Post Details
Added 6 days ago
2 comments
104 views