Always include CREATE TABLE and INSERT statements in your questions. These are minimal, and just educated guesswork.
create table table2 (
table2Id integer primary key,
userId integer not null unique,
username varchar(20) not null unique,
password varchar(15) not null
);
create table table1 (
table1Id integer primary key,
access_level integer not null,
userid integer not null references table2 (userId)
);
insert into table2 values (1, 1, 'a', 'a');
insert into table1 values (1, 3, 1);
insert into table2 values (2, 2, 'b', 'b');
IMHO, table1.access_level and table2.username should be declared NOT NULL. I edited your query with that in mind.
select e.username,
e.password,
coalesce(m.access_level, 0) as access_level
from table2 e
left join table1 m on e.userid = m.userid
username password access_level
--
a a 3
b b 0
Now, what you need to do with that in order to manage access and authentication is a different issue.