gpt4 book ai didi

c# - 如果某些数据为空,Winforms datagridview 将不会加载数据

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

我的数据库中有 3 个表。学校(一对多)-学生(一对一)-金钱。一切正常,但是我有一个 datagridview,它内部连接所有三个表,但它不会显示任何在 Money 表中没有任何数据的数据。因此,所有在资金表中保存信息的学生也会出现,但我也想看到那些在资金表中也没有数据的学生。是应该这样吗?谢谢

最佳答案

从那里Using Outer Joins

Inner joins return rows only when there is at least one row from both tables that matches the join condition. Inner joins eliminate the rows that do not match with a row from the other table.

如果您想显示没有 Money 记录的行,请在 sql 查询中使用 LEFT JOIN。

SELECT sch.SomeColumn
FROM School sch
INNER JOIN Students sts ON <some students condition>
LEFT JOIN Money m ON <some money condition>

引用和示例来自Sql Server,但也适用于MySql

关于c# - 如果某些数据为空,Winforms datagridview 将不会加载数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34704205/

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