Solved

Compare the Date and Time of the same column in the same table

Posted on 2015-01-13
4
75 Views
Last Modified: 2015-01-27
I need to find multiple occurrences of the exact date and time in the same "create date" column in the same table. We had an issue where a return authorization record was created on the same date and at exactly the same time, it had the same address but different names and serial numbers, I am trying to determine if there are any more that may have occurred and put some preventives measures in place to catch this.     Exact Date and Time
0
Comment
Question by:skull52
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 40547036
To find the duplicates...

SELECT DateCreated, COUNT(1) AS Cnt
FROM YourTable
GROUP BY DateCreated
HAVING COUNT(1) > 1

Open in new window

0
 
LVL 5

Expert Comment

by:MohitPandit
ID: 40547054
To fetch:

SELECT
	*
FROM YourTable
WHERE DateCreated IN
(
	SELECT DateCreated
	FROM YourTable
	GROUP BY DateCreated
	HAVING COUNT(1) > 1
)
ORDER BY DateCreated

Open in new window

0
 

Author Comment

by:skull52
ID: 40547063
Thanks for the quick response Patrick, but your query is giving me results that may not be accurate, for example  2013-07-29 10:45:04.000 shows 19 occurrences for that date and time this may because I also need to match other columns, such as address state and Zip.
0
 

Author Comment

by:skull52
ID: 40547098
OK, so... the reason I got so many occurrences, which is accurate , is that  that if the customer is returning multiple items it generates a RA number for each and uses the same time stamp.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now