日期:2014-05-19  浏览次数:20450 次

消除重复数据,急~~~
select   *   from   table   A   where   id=(select   max(id)   from   table   where   A.id=id   and   id <> 0)--------消除重复行数据,当ID=0的时候不算重复数据,现在我不想查询两遍获取数据,请问有什么好方法呢?

------解决方案--------------------
select distinct 字段 from table A
where id <> 0

------解决方案--------------------
SELECT DSITINCT
[ID],
******
FROM
[table]
WHERE
[ID] = 0
UNION ALL
SELECT
[ID],
******
FROM
[table]
WHERE
[ID]> 0
------解决方案--------------------
UP,工作做完再说,楼主还要讲华丽和美观啊