Answer the question
In order to leave comments, you need to log in
How to pull string value through int in related tables?
There is a users
table :
id_user: 1
username(var): root
password(var): root
role(int): 1
department(int): 1
id_role: 1
role: admin
id_department: 1
department: all
select role from users where username="root" and password = "root";
role = session.createQuery("Какой запрос сюда ставить?").toString();
Answer the question
In order to leave comments, you need to log in
LEFT JOIN
SELECT role.role FROM users LEFT JOIN role ON users.role=role.id WHERE users.username="root" AND users.password = "root";
Should work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question