C
Clive Minnican
Hello,
I have a database table called Customers and I want to use SQL to display
all the records between 2 specific times for each day e.g. between 08:00:00
and 18:00:00.
The following query works:
SELECT * FROM Customers
WHERE [ID]=83 AND [Date] BETWEEN #2004-01-01 08:00:00# AND #2004-03-31
18:00:00#
ORDER BY [Date];
but it doesn't restrict the times for each day to the times specified.
I have tried using this query instead:
SELECT * FROM Customers
WHERE [ID]=83
AND ([Date] BETWEEN #2004-01-01# AND #2004-03-31#)
AND ([Date] BETWEEN #08:00:00# AND #18:00:00#)
ORDER BY [Date];
but it returns no results! I have also tried:
SELECT * FROM Customers
WHERE [ID]=83 AND [Date] BETWEEN #08:00:00# AND #18:00:00#
ORDER BY [Date];
but this returns no results either
Please tell me if there is a way to achieve this. I'm sure there must be a
simple solution.
I am connecting to an Access database via ODBC with Visual C++ 6.0 so I can
only use normal SQL and not custom Access functions.
Many thanks,
Clive.
I have a database table called Customers and I want to use SQL to display
all the records between 2 specific times for each day e.g. between 08:00:00
and 18:00:00.
The following query works:
SELECT * FROM Customers
WHERE [ID]=83 AND [Date] BETWEEN #2004-01-01 08:00:00# AND #2004-03-31
18:00:00#
ORDER BY [Date];
but it doesn't restrict the times for each day to the times specified.
I have tried using this query instead:
SELECT * FROM Customers
WHERE [ID]=83
AND ([Date] BETWEEN #2004-01-01# AND #2004-03-31#)
AND ([Date] BETWEEN #08:00:00# AND #18:00:00#)
ORDER BY [Date];
but it returns no results! I have also tried:
SELECT * FROM Customers
WHERE [ID]=83 AND [Date] BETWEEN #08:00:00# AND #18:00:00#
ORDER BY [Date];
but this returns no results either
Please tell me if there is a way to achieve this. I'm sure there must be a
simple solution.
I am connecting to an Access database via ODBC with Visual C++ 6.0 so I can
only use normal SQL and not custom Access functions.
Many thanks,
Clive.