如何从两个表中获取first_name,email,user_type?
table 1 ( recruiter_master )
1)recruiter_id
2)first_name
3)email
4)password
5)user_type
table 2 ( freelancer_master )
1)freelancer_id
2)first_name
3)email
4)password
5)user_type
我想获取recruiter_id / freelancer_id,first_name和email,user_type。 如果电子邮件和密码匹配相关表的返回数据。
SELECT *
FROM `recruiter_master`, `freelancer_master`
WHERE (recruiter_master.email="abc@gmail.com" AND
recruiter_master.password="abc123") OR
(freelancer_master.email="abc@gmail.com" AND
freelancer_master.password="abc123")
它返回两个表数据。
答案 0 :(得分:0)
您需要的是Func<Person, Person>
Union
答案 1 :(得分:0)
SELECT
recruiter_id,
freelancer_id,
recruiter_master.first_name,
recruiter_master.email,
recruiter_master.user_type
FROM recruiter_master
INNER JOIN freelancer_master
ON recruiter_master.email = freelancer_master.email
AND recruiter_master.password = freelancer_master.password
WHERE (recruiter_master.email="abc@gmail.com" AND recruiter_master.password="abc123")
你想要:
recruiter_master.first_name,
recruiter_master.email,
recruiter_master.user_type
或:
freelancer_master.first_name,
freelancer_master.email,
freelancer_master.user_type
此致