按组排序依据

扫码查看
本文介绍了按组排序依据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个包含三列的表:datetime,subject,&作者。 (还有

多列,但这些是唯一相关的。)


有些行会有相同的主题。对于每个主题,我需要选择

作者和最新的日期/时间戳。


任何想法?

Hi,

I have a table with three columns: datetime, subject, & author. (There are
more columns, but these are the only relavent ones.)

Some rows will have identical subjects. For each subject, I need to select
the author with the most recent date/time stamp.

Any ideas?

推荐答案




是的,升级到4.1版。请参阅我的主题找到所有产品的最高价格

版本在那里我解决了从产品表(其中有colums id,product,

版本)中找到最大产品和ID的问题。对于您的情况,请将版本替换为日期,将产品替换为主题,

id与作者。



Yes, upgrade to version 4.1. See my thread "find all products with maximum
version" where I solved the problem of finding product and id with maximum
version number from the product table (which has colums id, product,
version). For your case, replace version with date, product with subject,
id with author.





是的,升级到4.1版。请参阅我的主题找到所有产品的最高价格

版本在那里我解决了从产品表(其中有colums id,product,

版本)中找到最大产品和ID的问题。对于您的情况,请将版本替换为日期,将产品替换为主题,

id与作者。



Yes, upgrade to version 4.1. See my thread "find all products with maximum
version" where I solved the problem of finding product and id with maximum
version number from the product table (which has colums id, product,
version). For your case, replace version with date, product with subject,
id with author.




完美的工作!非常感谢!我使用了max(`datetime`)和分组

` subject` ...不需要升级。


再次感谢

Graham


Works perfectly! Thanks so much! I used max(`datetime`) and group by
`subject` ...didn''t need to upgrade.

Thanks again
Graham


这篇关于按组排序依据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 17:43
查看更多