SQL 查询语句,, 100% 结贴, 在线等
为什么这条语句查不到数据
----------------------------
-- 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
--不可能啊,用下面的语句试试
select CONVERT(VARCHAR(19),CreateTime,120) from Auctionsell group by CONVERT(VARCHAR(19),CreateTime,120) having count(*)>1
--能查出2行记录吗?
SELECT * FROM Auctionsell WHERE createtime = '2013-6-1 10:10:27'