select a.vcplid, a.vcpuid,a.vcproductname,a.vcproductimage,a.vcwaycode from tbproductlist a
where vccommend=1 order by dtdatelist desc 我想查询vcpuid 字段不重复的记录,不知道怎么用子查询,谢谢.(oracle)
where vccommend=1 order by dtdatelist desc 我想查询vcpuid 字段不重复的记录,不知道怎么用子查询,谢谢.(oracle)
解决方案 »
- 如何避免TABLE ACCESS BY GLOBAL INDEX ROWID
- gv$global_transaction访问慢,请问是什么原因,有什么解决方法?
- 哪里能下载到ORACLE9.2.0.4 for linux的patch文件?
- 如何在本地机器上安装使用数据库!?
- 请教oracle9i中删除大型对象记录后空间为什么没有还给操作系统
- SQL*Net的别名在哪里可以看到?
- 各位大哥,烦劳您帮忙拉小弟一把,
- 如何删除归档日志文件?
- 请问被锁定的记录能不能解锁?如何解锁?
- 关于Oracle和win7-64bit的兼容性问题
- 已知ip地址,如何获取远程数据库的服务名!
- 请高手写一个SQL,有一个表A,根据某种条件选出若干条记录,其中每一条记录都与另外一个表B中若干条记录相关联,我现在想在A的没一条记录
where vccommend=1
and vcpuid in (select vcpuid ,count(*) from tbproductlist group by vcpuid having count(*)=1 ) order by dtdatelist desc
这个地方有两个字段,不行的,只能是and vcpuid in (select vcpuid from
select max(rowid) from tbproductlist group by vcpuid
)
where vccommend=1
and vcpuid in (select vcpuid from tbproductlist group by vcpuid having count(*)=1 ) order by dtdatelist desc
where vccommend=1 and vcpuid in
(select vcpuid from
(select distinct vcpuid,count(*) from tbproductlist group by vcpuid
having count(*) = 1))
order by dtdatelist desc还可以用. select a.vcplid, a.vcpuid,a.vcproductname,a.vcproductimage,a.vcwaycode from tbproductlist a
where vccommend=1 and not exists(
select 'x' from tbproductlist b where a.vcpuid = b.vcpuid and a.rowid <> b.rowid)
order by dtdatelist desc还有其它方法. 比如用两个表并联. 很多方法的. 建议: 若是平时一次性使用, 建立建立中间表, 这样速度会快.
where vccommend=1
and vcpuid in (select vcpuid ,count(*) from tbproductlist group by vcpuid having count(*)=1 ) order by dtdatelist descorselect a.vcplid, a.vcpuid,a.vcproductname,a.vcproductimage,a.vcwaycode from tbproductlist a
where vccommend=1
and vcpuid in (select distinct vcpuid from tbproductlist) order by dtdatelist desc