472,353 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

most recent, min/max query

hello-

i have a sample database that i want to query for most recent SAMPLE,
min SAMPLE_RESULT, and max SAMPLE_RESULT.

the table is orgainzed as such:
SAMPLE | SAMPLE_DATE | SAMPLE_TIME | SAMPLE_RESULT

any ideas?

Nov 13 '05 #1
1 1417
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If possible, you should put the sample_date & time in one column, it
will eliminate the need to create an expression in the WHERE clause that
creates a DateTime data type. Since you don't give a DDL definition of
your table I'll have to guess at the data types. I'll assume that your
sample_date & time are stored as DateTime data types. If they aren't
DateTimes you have to convert them using the CDate() function before
adding them together. Note that #3:30# is 3:30 AM (0330) and #03:30PM#
is 3:30 PM (1530).

Just a guess:

SELECT sample, Min(sample_result) As min_result, Max(sample_result) as
max_result
FROM table_name as t
WHERE sample_date + sample_time =
(SELECT Min(sample_date + sample_time)
FROM table_name
WHERE sample = t.sample)

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQgzzYIechKqOuFEgEQJV7gCg1hDXXhtf7JQvZoI315JRPo E3Vw0AoJU3
1r2ZLlYyylNhERy9aWh3YSsN
=W7eX
-----END PGP SIGNATURE-----
getyourbiglobster wrote:
hello-

i have a sample database that i want to query for most recent SAMPLE,
min SAMPLE_RESULT, and max SAMPLE_RESULT.

the table is orgainzed as such:
SAMPLE | SAMPLE_DATE | SAMPLE_TIME | SAMPLE_RESULT

Nov 13 '05 #2

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

Similar topics

2
by: Shaiguy | last post by:
I have a table containing the following fields: ProjectUpdateID (PrimaryKey) ProjectID UpdateDate I would like to create a Query in Ms Access...
3
by: manny | last post by:
Problem: how to have query show only most recent records. This query shows all exams in 2005 for particular individual (grades not shown to avoid...
5
by: bill1313 | last post by:
I'm currently working on a component tracking file and we are using an hour meter query to always have up to date information. My problem is that I...
4
by: bill1313 | last post by:
I'm currently working on a component tracking file and we are using an hour meter query to always have up to date information. My problem is that I...
3
by: AnthonyT | last post by:
Hi All I have a major problem with an access query and I am near the end of my tether! I have taken over a project with a badly built access...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.