gpt4 book ai didi

mysql - 显示左表中的所有数据认为右表缺少一些数据

转载 作者:行者123 更新时间:2023-11-29 14:10:34 25 4
gpt4 key购买 nike

我有 2 个表,其中一个表包含有关我拥有的所有应用程序的信息,其他表包含有关已安装所有应用程序的所有用户列表的信息。

如果我触发以下查询,它会给出我想要的正确结果,即主表中的所有记录以及设置表中的相应值

您可以在 http://sqlfiddle.com/#!2/5b39d/2 找到此结果

但是如果我更改缺少一些记录的用户,我会得到错误的结果,从而导致一个结果丢失。

您可以在 enter link description here 找到结果

请提供良好的查询以获取左侧的所有结果,右侧有一些缺失的数据。

最佳答案

    Here, tablea and table2 is left and right table.
Col1 and col2 is common table both.
and col3 is which column is not found in table1 missing entry,

Ex:

select t1.* from table1 t1
left outer join table t2 on t1.colname1=t2colname2
where t2.colname3!=null

your Ex:

SELECT *
FROM `master_apps` `master`
LEFT OUTER JOIN `tbl_settings` `uas` ON `uas`.`app_id` = `master`.`id`
WHERE
master.app_active = "1"
AND uas.uid != NULL

关于mysql - 显示左表中的所有数据认为右表缺少一些数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13563618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com