473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Selecting 2 sets of data

I have the following case and need some help ... I need to select two
groups of data based on the time stamp.

Table 1

Card | Date | Time | #1 | #2 | #3
-----------------------------------------------------
1 | 2004-09-09 | 19:39:21 | 841630 | 251534 | 110
2 | 2004-09-09 | 19:39:21 | 895424 | 256112 | 86
3 | 2004-09-09 | 19:39:21 | 895527 | 256881 | 109
1 | 2004-09-09 | 19:49:51 | 841750 | 251545 | 112
2 | 2004-09-09 | 19:49:51 | 895634 | 256173 | 88
3 | 2004-09-09 | 19:49:51 | 895937 | 256885 | 113
1 | 2004-09-09 | 19:59:42 | 841934 | 251554 | 112
2 | 2004-09-09 | 19:59:42 | 895886 | 256182 | 89
3 | 2004-09-09 | 19:59:42 | 896222 | 256892 | 113

I need the latest set of data (time 19:59:42) for all three cards and
then I will need the next previous set of data (time 19:49:51) for all
three cards.

After I have the data, I'll do calculations to arrive at %, etc.

To select the max time, I've tried the following:

select table1.* from table1 left join table1 as t2 on table1.card =
t2.card and table1.time < t2.time where t2.card IS NULL order by
date,time,card;

I don't know how to determine the previous set of data...

Any help would be greatly appreciated.
Jul 20 '05 #1
0 1218

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dave Benjamin | last post by:
Hola, I made a backport of sets.py that will run on Jython 2.1. Here is a diff against the Python 2.3 version of sets.py. The changes were simple, but I may have made a mistake here or there,...
4
by: Sugapablo | last post by:
I have column data that looks like this: id | ColumnA ---+----------- 1 | 12,35,123 2 | 1,23 3 | 233,34,35 4 | 34 And I want to be able to make a WHERE clause where I can match up a
3
by: Mark Wheadon | last post by:
Hello, We have a 'standard letters' type app that can produce the letter as an XSL-FO document. We have used FOP to produce PDFs and are quite impressed. We also need to be able to print the...
2
by: Paul Marshall | last post by:
Hi, I'm doing some analysis on a database of log messages and wondered if anyone could help me pull out the data I need (I'm a MySQL newbie) I have the following table called message which...
1
by: Erik Hendrix | last post by:
Hi, I have some questions related to stripe sets that I'm hoping someone here can answer. 1) What happens to stripe sets when doing a database restore? Do they stay as is? 2) What happens...
48
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a...
3
by: M.L. Abram | last post by:
Hello all, I do not know if this question is regarding table design, queries, or programming. Below, I have given a table design using Access 2003. Fields 'Product' and 'Color' are primary keys...
9
by: rickou812 | last post by:
What I am attempting to do is create a form field in which a company name can be selecting from a drop down box. When selecting I want to display the information from my database about the selected...
6
by: rdemyan via AccessMonster.com | last post by:
I don't understand why I can get the following to work: ------------------------------------------------------------------------------ -- SELECT A.*, B.* FROM TableA AS A, TableA AS B IN...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.