Our site has 5 pages. Only one group of users with access level 3 are allowed to view all sites.

Those without access level 3 have less priviledges.

table1 has a list of all users with access level 3

The structure is thus:

```
table1 
table1Id
access_level
userid

```

Then there is table2 with rest of users

```
table2
table2Id
userId
username
password

```

All users in table1 also belong to table2. That's why they are able to see all pages.

userId is the relationship between table1 and table2.

What I would like to accomplish with this query below is ensure that ALL users, both on table1 and table2 are accounted for.

In other words, they all have the ability to login in successfully.

Part two of my task is to ensure that only users with access level 3 get to see all pages while those without it, see limited pages.

This part is not part of this question.

My question is, how do I ensure that all users have the ability to successfully log in as long as their credentials can be authenticated?

Below is code and thank you in advance for your help.

```
select username, 
       password, 
       isnull(access_level,0) access_level 
from table2 e 
left join table1 m on e.userid = m.userid
where username is not null

```

This query is producing only 0s (zeros).

There are a total of 589 records with access\_level 3 and overall total of 7,209.

This is for SQL Server