按组排序依据 [英] Order by before group by

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

问题描述




我有一个包含三列的表: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?

推荐答案

有经验但未记录的 < e0*@removethis.toao.net>在消息中写道
"Experienced but Undocumented" <e0*@removethis.toao.net> wrote in message
我有一个包含三列的表:datetime,subject,&作者。 (
是更多列,但这些是唯一相关的。)

有些行会有相同的主题。对于每个主题,我需要
选择带有最新日期/时间戳的作者。
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.




是的,升级到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.


经验丰富但未记录的 < e0*@removethis.toao.net>在消息中写道
"Experienced but Undocumented" <e0*@removethis.toao.net> wrote in message
我有一个包含三列的表:datetime,subject,&作者。 (
是更多列,但这些是唯一相关的。)

有些行会有相同的主题。对于每个主题,我需要
选择带有最新日期/时间戳的作者。
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.




是的,升级到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.


" Siemel Naran" <硅********* @ REMOVE.att.net>写了
"Siemel Naran" <Si*********@REMOVE.att.net> wrote
是的,升级到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


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆