If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > calculation values

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-23-04, 10:36
wasimf wasimf is offline
Registered User
 
Join Date: Mar 2004
Posts: 128
Question calculation values

Hi all,
I had posted a problem,and I didn't get the obvious solution, can you help me please:

My table looks like the following:

Date\Time Counter1 Counter2

The counters are taken by an automatic system in three shifts:
First in : 6:00 AM Second in: 15:00 PM Third in : 11:00 PM

I want a query to calculate the difference of the counters between the three shifts (Let's begin with this).

For example: The following table
22/11/04 11:00 PM 0 0
23/11/04 6:00 AM 10 20
23/11/04 15:00 PM 20 30
23/11/04 23:00 PM 30 40

The output is:
23/11/04 6:00 AM 10 20
23/11/04 15:00 PM 10 10
23/11/04 11:00 PM 10 10

I'm new I the SQL world. can you please help me and give me sum information to solve the problem.
Reply With Quote
  #2 (permalink)  
Old 11-23-04, 11:02
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 11-26-04, 07:36
wasimf wasimf is offline
Registered User
 
Join Date: Mar 2004
Posts: 128
Red face SQL query

But, the answer isn't sufficient to my problem.
thanks...
Reply With Quote
  #4 (permalink)  
Old 11-26-04, 08:02
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
then you will have to ask your question a bit more clearly

maybe we do not understand the problem
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 11-26-04, 15:05
wasimf wasimf is offline
Registered User
 
Join Date: Mar 2004
Posts: 128
Lightbulb SQL query

I'll explain secondly,
my really table is the following:
1. CollectDate (Date/Time): The date and time of collecting data.
2. MachineNum (Number): The machine number of the data. I have 40...50 machines.
3. WorkOrder (Number): A number witch discribe the part of the machine.
4. TotalGood (Number): An accumulator of the current parts that the machine did.

The total task of the query is to calculate how many parts did the machine do in a certain date but by shifts.
E.g:
the final date collection was:
CollectDate MachineNum WorkOrder TotalGood
25/11/04 23:00:00 40 00111 100
26/11/04 6:00:00 40 00111 200
26/11/04 15:00:00 40 00111 500
26/11/04 23:00:00 40 00111 1000

The query output is:
Shifts(26/11/04) MachineNum WorkOrder TotalGood
6:00:00 40 0011 100 (200-100)
15:00:00 40 0011 300 (500-200)
23:00:00 40 0011 500 (1000-500)

Please help me.
Best regards...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On