gpt4 book ai didi

php - 选择 2 个不同的字段,但还返回其余列

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

我想明确选择表中的两个字段。

我使用以下方法来做到这一点:

SELECT DISTINCT `from`, `to` FROM `messages` WHERE `from`='9129771472' // the condition is just an example, any number could be there

问题在于,仅选择了 fromto。我需要使用更多列。

我确信有一个快速解决此问题的方法。我看过有关此问题的其他帖子,但到目前为止没有任何帮助。

最佳答案

不使用GROUP BY的原因是什么

SELECT * FROM `messages` WHERE `from`='9129771472' GROUP BY `from`

或者

    SELECT * FROM `messages` WHERE `from`='9129771472' GROUP BY `from`,`to`

关于php - 选择 2 个不同的字段,但还返回其余列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17073888/

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