kbhamber

kbhamber

  • NA
  • 11
  • 0

SQL Query

Apr 18 2005 11:57 AM
I have following table which is stored in MS Access database Col1 Col2 Col3 A 3.2 25/10/2000 9:30:00 AM A 2.1 25/10/2000 10:10:02 AM A 1.5 25/10/2000 1:00:02 PM A 2.3 25/10/2000 2:10:05 PM A 10 26/10/2000 9:10:10 AM A 1.2 26/10/2000 9:10:11 AM A 4.8 26/10/2000 1:00:08 PM I want to use SQL query so that I can achieve the following: Problem 1: Pick only those records (At the most one per each day) based on max value of Col2 (Max value should be within the context of one day). So it should give me following result set A 3.2 25/10/2000 9:30:00 AM (Max value picked on Day 25/10/2000) A 10 26/10/2000 9:10:10 AM (Max value picked on Day 26/10/2000) Problem 2: Pick only those records (At the most one per each day) based on min value of Col2 (Min value should be within the context of one day). So it should give me following result set A 1.5 25/10/2000 1:00:02 PM (Min value picked on Day 25/10/2000) A 1.2 26/10/2000 9:10:11 AM (Min value picked on Day 26/10/2000) Problem 3: Pick only those records (At the most one per each day) based on most recent value of Col3 (Most recent value value should be within the context of one day). So it should give me following result set A 2.3 25/10/2000 2:10:05 PM (Most recent value(based on time) picked on Day 25/10/2000) A 4.8 26/10/2000 1:00:08 PM (Most recent value(based on time) picked on Day 26/10/2000)