$('#password_notify').replace(data.html).fadeOut(2000);
,第二个表是“tab_user”
task_id| task_name | created_by | status
-------------------------------------------
1 | task1 | aarav | 1
2 | task2 | rahul | 0
3 | task3 | aarav | 0
4 | task4 | jasmin | 0
5 | task5 | yamini | 1
6 | task6 | priyanka | 0
7 | task7 | manish | 1
8 | task8 | aarav | 1
user_id| txt_full_name|
-------------------------
1 | aarav |
2 | rahul |
3 | yamini |
4 | jasmin |
5 | manish |
6 | priyanka |
现在我们有4行“aarav,yamini,manish和aarav”。
现在我想从“tab_user”获取“txt_full_name”,其中“txt_full_name”不等于“tab_task的created_by”。 我的意思是我想从“tab_user”获取rahul,jasmin,priyanka。
答案 0 :(得分:2)
一个简单的解决方案:
SELECT txt_full_name FROM tab_user
WHERE txt_full_name NOT IN (SELECT created_by from tab_task where status='1')
(请注意,以上假设created_by
列为NOT NULL
,否则查询将不会返回任何行,因为与NULL
进行比较会产生UNKNOWN
- {{3 }})。
答案 1 :(得分:1)
除了@Jiri Tousek的function submitForm(form) {
var submitFormFunction = Object.getPrototypeOf(form).submit;
submitFormFunction.call(form);
}
解决方案,您还可以使用IN
,JOIN
语法:
EXISTS
或者
select u.txt_full_name
from tab_user u
left join tab_task t
on u.txt_full_name = t.created_by
and t.status = '1'
where t.created_by is null;
并在此处查看demo。
答案 2 :(得分:0)
尝试连接表,然后选择空行:
SELECT txt_full_name FROM tab_user
LEFT OUTER JOIN
(
SELECT created_by from tab_task where status='1'
)tbStat
ON created_by = txt_full_name
WHERE created_by IS NULL