473,811 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove Duplicate events.

4 New Member
Please help.

I am working on a database that logs the alarm events from a machine. The problem I have is that I need to explain why the machine has stopped and calculate the time it stops for. I then report the total time stopped.

This is fine when only 1 alarm was present as the raw table only has 1 relevant entry at that time. But if there were two alarms then I get two entries at that time. I only need one of the entries at that time, It doesn't matter which one.

I have a query that runs and shows only the alarms so I can see the duplicates but I'd like to remove any duplicates based only on the time column.

The table/query.

Event, EventTimeUTC, Event Value.

I want to show all of these but only the first occurance by event time EventTime.

I have tried everything I can think of but I always return all rows.

Below is an example of where I need this to work. I only want to see one alarm here it doesn't matter which.

Event EventTimeUTC Value
Flags (00-15) 28/02/2008 20:38:41 524288
Flags (96-111) 28/02/2008 20:38:41 536870912

I cannot alter the original table and would prefer to have just a simple query showing the first occurence by time.

I hope someone can help, I have spent hours surfing the net for an answer.

Regards
Kris Bishop
Mar 3 '08 #1
6 1846
MindBender77
234 New Member

I have tried everything I can think of but I always return all rows.

Below is an example of where I need this to work. I only want to see one alarm here it doesn't matter which.

Event EventTimeUTC Value
Flags (00-15) 28/02/2008 20:38:41 524288
Flags (96-111) 28/02/2008 20:38:41 536870912
You could write a query using "Distinct" which will only display data once. You can add this in the SQL view in the query designer. I believe it might help in your case.
Example (Something Like This)
Expand|Select|Wrap|Line Numbers
  1. Select Event, Distinct(EventTimeUTC), Value from YourTableName
  2.  
Bender
Mar 3 '08 #2
Bishopkris40
4 New Member
I thought there was more to the distinct statement, I will try this out. Any other Ideas?
Mar 4 '08 #3
Bishopkris40
4 New Member
I get a syntax error when I use the following code

SELECT Clean_Up_Filter ed.Tag, Clean_Up_Filter ed.ActiveTimeUT C, DISTINCT (Clean_Up_Filte red.EventTimeUT C), Clean_Up_Filter ed.[Value For Doubles]
FROM Clean_Up_Filter ed

I can do something that will sort things out at the report time, but this has to be a running query so I can report in real time, I have other software for this but I need the raw data to update as a query.

I'm using Access 2002 SP3
Mar 4 '08 #4
MindBender77
234 New Member
I get a syntax error when I use the following code

SELECT Clean_Up_Filter ed.Tag, Clean_Up_Filter ed.ActiveTimeUT C, DISTINCT (Clean_Up_Filte red.EventTimeUT C), Clean_Up_Filter ed.[Value For Doubles]
FROM Clean_Up_Filter ed

I can do something that will sort things out at the report time, but this has to be a running query so I can report in real time, I have other software for this but I need the raw data to update as a query.

I'm using Access 2002 SP3
I think the problem is with the parenthesis. Try
Expand|Select|Wrap|Line Numbers
  1. SELECT Clean_Up_Filtered.Tag, Clean_Up_Filtered.ActiveTimeUTC, DISTINCT Clean_Up_Filtered.EventTimeUTC, Clean_Up_Filtered.[Value For Doubles]
  2. FROM  Clean_Up_Filtered;
  3.  
Bender
Mar 4 '08 #5
Bishopkris40
4 New Member
I still get an error with that but it changes to
syntax error, (missing operator) in query expression 'DISTINCT Clean_Up_Filter ed.EventTimeUTC '

Thanks for your help so far,

I am working on creation of a new table that has an indexed key on event time which should eliminate the doubles at source, but this is meaning that I am logging twice as much data so that I have a log of double alarms.

This is why I prefer to do this in a query so I can have all the raw data and pull out only the relevant infomation.

Please help solve this issue.
Mar 5 '08 #6
Stewart Ross
2,545 Recognized Expert Moderator Specialist
I think the problem is with the parenthesis. Try
Expand|Select|Wrap|Line Numbers
  1. SELECT Clean_Up_Filtered.Tag, Clean_Up_Filtered.ActiveTimeUTC, DISTINCT Clean_Up_Filtered.EventTimeUTC, Clean_Up_Filtered.[Value For Doubles]
  2. FROM Clean_Up_Filtered;
  3.  
Bender
Hi. The DISTINCT keyword immediately follows SELECT. Its effect is to return unique rows; it is not used as a field qualifier, hence your syntax problems. DISTINCT and the similar but non-standard DISTINCTROW are well-documented in the Access Help file.
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Clean_Up_Filtered.Tag, Clean_Up_Filtered.ActiveTimeUTC, Clean_Up_Filtered.EventTimeUTC, Clean_Up_Filtered.[Value For Doubles]
  2. FROM Clean_Up_Filtered;
-Stewart
Mar 5 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2472
by: Patrick G. | last post by:
Greetings all: ASP VB, SQL Svr 2000 I am pulling data from 3 tables. table1 holds item details table2 holds publication types and the item id from table1 table3 holds category types and the item id from table1
7
23938
by: Voetleuce en fênsievry | last post by:
Hello everyone. I'm not a JavaScript author myself, but I'm looking for a method to remove duplicate words from a piece of text. This text would presumably be pasted into a text box. I have, for example, a list of town names, but there are hundreds of duplicates, like: "Aberdeen Aberdeen Aberdeen Edinburg Edinburg Inverness etc."
0
1084
by: John Seaden | last post by:
Hi, anyone have any idea why I get duplicate changed events firing from a filesystemwatcher watching a file on a remote machine but not on the local machine? Any suggestions as to how to eliminate the duplicate or ignore it? Thanks
3
7595
by: Franco, Gustavo | last post by:
How can I remove all event handler from one event without do -=? I won't explain why because is too long, and that the only option left I have right now. I have one event declared for: AppDomain.CurrentDomain.AssemblyResolve += XFUNCTION I need to remove all event handlers for the event AssemblyResolve in the
1
1971
by: TaeHo Yoo | last post by:
I have a table that has more than 1 milion rows so practically it is impossible to remove all duplicate rows by hand. Could you help me to remove those duplicate rows at all? This table doesn't have primary key( identity ) column. Say Table name => MyTable Column => Col1,Col2,Col3 No primary key column here. Thanks a lot in advance.
14
21987
by: BarrySDCA | last post by:
I have a database being populated by hits to a program on a server. The problem is each client connection may require a few hits in a 1-2 second time frame. This is resulting in multiple database entries - all exactly the same, except the event_id field, which is auto-numbered. I need a way to query the record w/out duplicates. That is, any records exactly the same except event_id should only return one record. Is this possible??
20
3969
by: David Levine | last post by:
I ran into a problem this morning with event accessor methods that appears to be a bug in C# and I am wondering if this a known issue. public event SomeDelegateSignature fooEvent; public event SomeDelegateSignature foo2Event; { add { // some code here } remove { // some code here }
6
12007
by: Dave | last post by:
I really don't like the users getting an unhandled expception page, and I'm still to new with ASP.Net and C#. So please accept my appology for the 2 part question. SqlException (0x80131904) 1.) Is an "Cannot insert duplicate key row" exception from a FormView returned as part of the ItemInserting or ItemInserted event? 2.) What is the recommended way to catch and deal with an "Cannot
4
9866
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in this context, in fact some articles from pre-2.0 suggest using any collection class of your choice. So my questions focus more on the syntax of event properties provided by the "event" keyword in C#. (Disclaimer - I am a C++ programmer working...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.