日期:2014-05-17  浏览次数:20364 次

SQL 查询语句,, 100% 结贴, 在线等
为什么这条语句查不到数据  
select CreateTime from Auctionsell  group by CreateTime having count(*)>1



数据库中是有相同数据的,  如图
SQL

------解决方案--------------------
select CreateTime from Auctionsell  group by CreateTime having count(CreateTime)>1
------解决方案--------------------
没问题啊
----------------------------
-- Author  :DBA_Huangzj(發糞塗牆)
-- Date    :2013-08-05 17:12:57
-- Version:
--      Microsoft SQL Server 2014 (CTP1) - 11.0.9120.5 (X64) 
-- Jun 10 2013 20:09:10 
-- Copyright (c) Microsoft Corporation
-- Enterprise Evaluation Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
--
----------------------------
--> 测试数据:[Auctionsell]
if object_id('[Auctionsell]') is not null drop table [Auctionsell]
go 
create table [Auctionsell]([createuid] int,[createtime] datetime,[submitmun] int)
insert [Auctionsell]
select 660084,'2013-6-1 10:10:27',120 union all
select 660129,'2013-6-1 10:10:27',30
--------------开始查询--------------------------

select?CreateTime?from?Auctionsell??group?by?CreateTime?having?count(*)>1
----------------结果----------------------------
/* 
CreateTime
-----------------------
2013-06-01 10:10:27.000
*/

------解决方案--------------------

select convert(varchar(19),CreateTime,120) from Auctionsell 
group by convert(varchar(19),CreateTime,120)
having count(*)>1

------解决方案--------------------
--不可能啊,用下面的语句试试