473,654 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A challenge in Operators-Alarm

2 New Member
Hi,
in MSSQL, I have 2 tables naming [Equipment Alarm History] , [EquipmentOperat ors]

Expand|Select|Wrap|Line Numbers
  1. [Equipment Alarm History]
  2. ---------------------------------------
  3. EquipmentID : nvarchar(50), FK, reference [EquipmentOperators].EquipmentID
  4. AlarmID : nvarchar(50), PK
  5. AlarmHappenTime : Datetime ,required, not null
  6. AlarmClearTime : Datetime, required, not null
and

Expand|Select|Wrap|Line Numbers
  1. [EquipmentOperators]
  2. -------------------------------------
  3. OperatorID: nvarchar(50), PK
  4. EquipmentID: nvarchar(50), PK
  5. LoginTime: Datetime, required, not null  
Logic:

The operator can login a machine, then machine cause alarms which stored in [Equipment Alarm History].

or

Machine cause alarms , then operator login, clear alarm.

Now the question is:
For equipmentID= SPD1, how can I know the OperatorID who most handle the AlarmID ( for example : AlamrID= '122042') during Jan-2007 and Feb-2007 ?

Which SQL statements should I use ?

I tried :
Expand|Select|Wrap|Line Numbers
  1. SELECT  COUNT(EquipmentOperators.OperatorID) as #, EquipmentOperators.OperatorID,
  2. Operators.Operator_Name
  3.  
  4. FROM [Equipment Alarm History] INNER JOIN EquipmentOperators 
  5. ON [Equipment Alarm History].EquipmentID = EquipmentOperators.EquipmentID 
  6. FULL OUTER JOIN Operators 
  7. ON EquipmentOperators.OperatorID = Operators.Operator_ID
  8.  
  9. WHERE([Equipment Alarm History].AlarmID = '122042') 
  10. AND ([Equipment Alarm History].EquipmentID = 'spd1') 
  11. AND 
  12. (
  13.     [Equipment Alarm History].Time BETWEEN 
  14.     CONVERT(DATETIME, '2007-02-01 00:00:00', 102) 
  15.     AND    CONVERT(DATETIME, '2007-03-01 00:00:00', 102)
  16. )
  17. AND (EquipmentOperators.Datetime BETWEEN CONVERT(DATETIME, '2007-02-01 00:00:00', 102) 
  18. AND    CONVERT(DATETIME, '2007-03-01 00:00:00', 102))
  19.  
  20. group by Operators.Operator_name,EquipmentOperators.OperatorID
Oct 11 '07 #1
0 1264

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

Similar topics

14
2510
by: greg | last post by:
Discussion is invited on the following proto-PEP. ------------------------------------------------------------- PEP ??? - Overloadable Boolean Operators ======================================== SUMMARY This PEP proposes an extension to permit objects to define their own
42
2963
by: Frank Buss | last post by:
I've setup a challenge, mainly for C++, Java and Lisp, but every other language is welcome: http://www.frank-buss.de/challenge/index.html There is nothing to win, but I hope there will be some interesting solutions at the end, so the win are the results :-) -- Frank Buß, fb@frank-buss.de
8
1703
by: Frank Buss | last post by:
A new challenge: http://www.frank-buss.de/marsrescue/index.html Have fun! Now you can win real prices. -- Frank Buß, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
2
3462
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those with 2's complement, 1's complement, or sign-magnitude arithmetic. But the followup remark is sometimes also made that the choice of arithmetic isn't completely unconstrained, since the bitwise operators seem to presume a base-2 machine.
0
1206
by: Richard Jones | last post by:
The date for the second PyWeek challenge has been set: Sunday 26th March to Sunday 2nd April (00:00UTC to 00:00UTC). The PyWeek challenge invites entrants to write a game in one week from scratch either as an individual or in a team. Entries must be developed in Python, during the challenge, and must incorporate some theme chosen at the start of the challenge. REGISTRATION IS NOT YET OPEN --
0
1229
by: richard | last post by:
The date for the second PyWeek challenge has been set: Sunday 26th March to Sunday 2nd April (00:00UTC to 00:00UTC). The PyWeek challenge invites entrants to write a game in one week from scratch either as an individual or in a team. Entries must be developed in Python, during the challenge, and must incorporate some theme chosen at the start of the challenge. REGISTRATION IS NOW OPEN --
78
4582
by: wkehowski | last post by:
The python code below generates a cartesian product subject to any logical combination of wildcard exclusions. For example, suppose I want to generate a cartesian product S^n, n>=3, of that excludes '*a*b*' and '*c*d*a*'. See below for details. CHALLENGE: generate an equivalent in ruby, lisp, haskell, ocaml, or in a CAS like maple or mathematica. #------------------------------------------------------------------------------- # Short...
3
1465
by: Thierry | last post by:
For those interested in <b>programming riddles</b>, I would like to announce a new programming challenge I'm just launching at http://software.challenge.googlepages.com This challenge is in its early stage and thus set to be continuously improved. I would be especially interested in your comments and feedbacks about this initiative and its relevance.
0
1326
by: Richard Jones | last post by:
The fifth PyWeek is only a month away. Come along and join the fun: write a video game in a week! There's some really interesting new libraries that have popped up recently. Have a gander on the pyweek message board for more info. REGISTRATION IS OPEN Visit the PyWeek website for more information:
80
3028
by: jacob navia | last post by:
Several people in this group argue that standard C is not portable since there are no compilers for it, etc. I propose this program in Standard C, that I have compiled in several OSes to test if this is actually true. My basic idea is to see which systems do not have a compiler that supports standard C. The program is designed to produce the sum of the natural integers up to a user provider argument. For instance
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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
8709
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
8494
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
8596
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
7309
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...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2719
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
2
1597
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.