由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - a sql question
相关主题
ask for help with a simple query!!!SQL中怎样用定制列排序?
help about SQL for ACCESS请教 select distinct
如何完成这个sql?SQL find distinct values in large table
请问这两个SQL QUERY有什么错?SQL select one value column for each distinct value another (转载)
SQL server 2000有hidden records吗?One sql question help!
more HELP: how to make this sql more efficient?How to write this query in Oracle?
[Mysql] how to return NULL count in group by query (转载)Help on Oracle Query
问个SQL问题A sql question
相关话题的讨论汇总
话题: sql话题: select话题: value话题: now话题: question
进入Database版参与讨论
1 (共1页)
p****m
发帖数: 1
1
the problem:
there is a table with 2 columns a and b, a is kind of a key but there are
duplicates. Now need a sql query which will return only one record per a
value and do not care which b value is returned as long as it is one
associated with a
I have thought about it for a while, don't select a, max(b) group by a or
select distinct(a),b work in this case?
Thanks!
M*****r
发帖数: 1536
2
http://www.mitbbs.com/article/Database/31138452_3.html

【在 p****m 的大作中提到】
: the problem:
: there is a table with 2 columns a and b, a is kind of a key but there are
: duplicates. Now need a sql query which will return only one record per a
: value and do not care which b value is returned as long as it is one
: associated with a
: I have thought about it for a while, don't select a, max(b) group by a or
: select distinct(a),b work in this case?
: Thanks!

b*****e
发帖数: 364
3
select a, max(b) group by a
Should work.
1 (共1页)
进入Database版参与讨论
相关主题
A sql questionSQL server 2000有hidden records吗?
请教一个querymore HELP: how to make this sql more efficient?
[转载] Can anyone interpret this simple SQL?[Mysql] how to return NULL count in group by query (转载)
急,SQL2005, 怎么查过去一小时里run过的所有query?问个SQL问题
ask for help with a simple query!!!SQL中怎样用定制列排序?
help about SQL for ACCESS请教 select distinct
如何完成这个sql?SQL find distinct values in large table
请问这两个SQL QUERY有什么错?SQL select one value column for each distinct value another (转载)
相关话题的讨论汇总
话题: sql话题: select话题: value话题: now话题: question