abpUsers表和数据
orders表和数据
内表联合:(表联合里面的所有表(字段)都可以查出来)
SELECT a.* FROM deyouyun_goods_import_tasks as a INNER JOIN deyouyun_goods_collect_infos as b on a.Id=b.Id
无论内联合有多少表,a表、b表、c表、d表,有多少表都可以查出来
内表联合中INNER可以省略不写
例子:SELECT a.,b. FROM orders as a INNER JOIN abpusers as b on a.CreatorUserId=b.Id
左联合:(左表的数据可以查询出来,左表和右表相关联的字段数据也可查出来。但是和左表没有关联数据的右表数据是查不出来的)
SELECT a.* FROM deyouyun_goods_import_tasks as a LEFT JOIN deyouyun_goods_collect_infos as b on a.Id=b.Id
例子:SELECT a.,b. FROM orders as a LEFT JOIN abpusers as b on a.CreatorUserId=b.Id
右联合:(右表的数据可以查出来,右表和左表相关联的字段数据也可以查出来。但是和右表没有关联的左表数据是查不出来的)
SELECT a.* FROM deyouyun_goods_import_tasks as a RIGHT JOIN deyouyun_goods_collect_infos as b on a.Id=b.Id
例子:SELECT a.,b. FROM orders as a RIGHT JOIN abpusers as b on a.CreatorUserId=b.Id
外联合:
left outer join,right outer join
左外联合:一切向左表看齐,先把左边表全显示了,右边满属足条件a.id=b.id的显示,不满足显示为空) 右连接同理