Hii伙计!!! 我有一个表,其中有一个名为“Calldate”的列,其中包含日期时间值。此列中有很多行,它们具有相同的日期和时间值。所以我需要从表中检索这些值。
Plz家伙帮我完成任务.. 提前完成。
答案 0 :(得分:1)
如果你只想检索重复的日期和时间值,那么答案应该是:
SELECT Calldate, COUNT(Calldate) FROM table GROUP BY Calldate HAVING COUNT(Calldate) > 1
这将返回具有重复日期和时间的记录;与日期和时间的总重复记录
答案 1 :(得分: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)
答案 2 :(得分: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