0

嗨伙计们!!!我有一个表,其中有一个名为“Calldate”的列,其中包含日期时间值。现在在此列中有很多行具有相同的日期和时间值。所以我需要从表中检索这些值。

请大家帮我完成任务.. 提前谢谢。

4

3 回答 3

1

如果您只想检索重复的日期和时间值,那么答案应该是:

选择通话日期,
COUNT(Calldate) FROM 表
按通话日期分组
HAVING COUNT(通话日期) > 1

这将返回具有重复日期和时间的记录;具有日期和时间的总重复记录

于 2012-12-05T07:10:32.907 回答
0
        The DATETIME values contain both date and time. MySQL retrieves and displays values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

        you may write the query as follows:

       to get all values:
        select Calldate from tableName

       to get the one record among multiple same records:
        select distinct(Calldate) from tableName

      to get the same valued records from column:

select Calldate from tableName
group by Calldate
Having count(Calldate)>1
于 2012-12-05T07:26:52.390 回答
0

尝试这个 :

Select 
* 
from table1 
inner join 
(
Select 
Calldate
from table 
group by Calldate 
having count(*)>1
) 
as temp_table on (table1.Calldate=temp_table.Calldate)
于 2012-12-05T06:58:29.270 回答