distinct使SQL查询除去重复的字段

sql语句去重,distict的用法:

select distinct 字段名 from [表名]

Sql = "Select * from (Select max(可输入顺序的字段) as indexfield,要去重复字段名 From 数据表 Where  条件 Group by   要去重复字段名) as A Where 条件  order by A.indexfield "

例子:
 

select distinct(orderno),keye,key1,addtime,dtype,consignee,address,bank,tel,email,yb,invoice,content,uid from indent where keye=0 order by id desc

posted on 2010-04-18 13:52  zock  阅读(31313)  评论(1编辑  收藏  举报