本文介绍了多列的SQL DISTINCT查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的表:
Artist Image Title
Smith 2 Country
Smith 5 Town
Doyle 21 Cat
Lawlor 24 Ball
Jones 8 Cheese
Jones 12 Bread
Jones 15 Butter
我想设置一个DISTINCT查询以一次返回Artist,这与返回哪条记录无关.这就是我要寻找的:
And I want to set up a DISTINCT Query to return the Artist once - doesn't matter which of the records are returned. This is what I'm looking for:
Artist Image Title
Smith 2 Country
Doyle 21 Cat
Lawlor 24 Ball
Jones 8 Cheese
我在MS Access数据库上使用ASP.
I am using ASP on a MS Access database.
非常感谢您的帮助.
推荐答案
访问权限具有FIRST
和LAST
聚合,其中r 返回按时间顺序输入的第一条或最后一条记录
Access has FIRST
and LAST
aggregates which return the first or last record as it was entered in chronological order
SELECT Artist, FIRST(Image) AS Image, FIRST(Title) AS Title
FROM table
GROUP BY Artist
这篇关于多列的SQL DISTINCT查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!