gpt4 book ai didi

mysql - 将 Max 函数与 datagridview 一起使用

转载 作者:行者123 更新时间:2023-11-30 00:44:04 25 4
gpt4 key购买 nike

我有一个充满机器订单的数据库。当机器订单发生变化时,修订级别也会发生变化,从0,1,2,......

我有同胞的MySql声明:

"SELECT reference as ""Reference"", serial_number as ""Serial Number"", revision as ""Revision"", Model as ""Model"" FROM `configurator`.`final_order` WHERE shipped = '0' GROUP by serial_number"

我也尝试过:

"SELECT reference as ""Reference"", serial_number as ""Serial Number"", MAX(revision) as ""Revision"", Model as ""Model"" FROM `configurator`.`final_order` WHERE shipped = '0' GROUP by serial_number"

这只是为我提供了该序列号的最大修订版本,但返回第一个条目而不是最后一个修订条目的所有数据。

我的数据库有数百个条目,我想用按序列号分组的所有条目填充 datagridview,但仅显示具有最高版本的序列号条目。我希望这是有道理的。

任何帮助将不胜感激。

谢谢

最佳答案

我不确定你想要什么,但也许是这样:

SELECT reference as ""Reference"", serial_number as ""Serial Number"", revision as ""Revision"", Model as ""Model"" 
FROM configurator.final_order
WHERE revision = MAX(revision) AND shipped = '0'
GROUP by serial_number

关于mysql - 将 Max 函数与 datagridview 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21534957/

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