Hai All,
i want to retrive records from a table between perticular datetime range.
the query is -
select * from geo_trip_history where
-
t.tr_start_date between '2008-02-02' and '2008-02-29' and
-
t.tr_end_date between '2008-02-02' and '2008-02-29' and
-
t.tr_start_time >='010000' and t.tr_end_time <='230000';
firing this query results in 5 records..
but when i change the t.tr_end_time <='010000'
this is giving me 0 records.
but this is not the desired result.It should give 5 records for this too.
kindly reply ..
wht should i do to retrive records between '2008-02-02 010000' to '2008-02-29 010000' .
12 7370
Hai All,
i want to retrive records from a table between perticular datetime range.
the query is
select * from geo_trip_histor y where
t.tr_start_date between '2008-02-02' and '2008-02-29' and
t.tr_end_date between '2008-02-02' and '2008-02-29' and
t.tr_start_time >='010000' and t.tr_end_time <='230000';
firing this query results in 5 records..
but when i change the t.tr_end_time <='010000'
this is giving me 0 records.
but this is not the desired result.It should give 5 records for this too.
kindly reply ..
wht should i do to retrive records between '2008-02-02 010000' to '2008-02-29 010000' .
Does ttr.start_date hold only date value or time as well?
Does ttr.start_date hold only date value or time as well?
t.tr_start_date and t.tr_end_date are date feilds and
t.tr_start_time and t.tr_end_time are Time feilds.
t.tr_start_date and t.tr_end_date are date feilds and
t.tr_start_time and t.tr_end_time are Time feilds.
Try this: -
-
select * from geo_trip_history where
-
t.tr_start_date between '2008-02-02' and '2008-02-29' and
-
t.tr_end_date between '2008-02-02' and '2008-02-29' and
-
t.tr_start_time >= TIME_FORMAT('010000','%H%i%s') and t.tr_end_time <=TIME_FORMAT('010000','%H%i%s');
-
-
thank you for the quick reply.but,
this did not help.But i think i can explain the problem bit clear.
the below is a set of records in geo_trip_histor y table
tr_start_date tr_start_time tr_end_date tr_end_time
2008-02-15 03:00:00 2008-02-15 05:00:00
2008-02-17 13:00:00 2008-02-17 17:00:00
2008-02-21 07:00:00 2008-02-21 17:00:00
2008-02-25 07:30:00 2008-02-25 10:00:00
2008-02-23 08:00:00 2008-02-24 10:00:00
from this i want to select records between '2008-02-02' '010000' to '2008-02-29' '010000'
Kindly help
thank you for the quick reply.but,
this did not help.But i think i can explain the problem bit clear.
the below is a set of records in geo_trip_histor y table
tr_start_date tr_start_time tr_end_date tr_end_time
2008-02-15 03:00:00 2008-02-15 05:00:00
2008-02-17 13:00:00 2008-02-17 17:00:00
2008-02-21 07:00:00 2008-02-21 17:00:00
2008-02-25 07:30:00 2008-02-25 10:00:00
2008-02-23 08:00:00 2008-02-24 10:00:00
from this i want to select records between '2008-02-02' '010000' to '2008-02-29' '010000'
Kindly help
Try this: -
-
SELECT * FROM geo_trip_history WHERE
-
t.tr_start_date BETWEEN '2008-02-02' AND '2008-02-29' AND
-
t.tr_end_date BETWEEN '2008-02-02' AND '2008-02-29' AND
-
t.tr_start_time >= TIME_FORMAT('01:00:00','%H:%i:%s') AND t.tr_end_time <=TIME_FORMAT('01:00:00','%H:%i:%s');
-
-
amit,
this too did not help me.it is also giving 0 records.I feel t.tr_end_time <='010000' is checking in each row for the time less then '010000' but this is not the desired.This is where im stuck.Is their any other way to fetch the records.
Thank u
amit,
this too did not help me.it is also giving 0 records.I feel t.tr_end_time <='010000' is checking in each row for the time less then '010000' but this is not the desired.This is where im stuck.Is their any other way to fetch the records.
Thank u
I had a check with your data and found that my query is working fine as per the conditions given. There needs to be a small change to make the query work as per your requirement. HEre it goes: -
-
SELECT * FROM geo_trip_history WHERE
-
DATE_FORMAT(t.tr_start_date||' '||t.tr_start_time,'%Y%m%d%H%i%s') >=
-
'20080202010000' AND DATE_FORMAT(t.tr_end_date||' '||t.tr_end_time,'%Y%m%d%H%i%s') <= '20080229010000'
-
-
Try this and post back if it does not work
I had a check with your data and found that my query is working fine as per the conditions given. There needs to be a small change to make the query work as per your requirement. HEre it goes: -
-
SELECT * FROM geo_trip_history WHERE
-
DATE_FORMAT(t.tr_start_date||' '||t.tr_start_time,'%Y%m%d%H%i%s') >=
-
'20080202010000' AND DATE_FORMAT(t.tr_end_date||' '||t.tr_end_time,'%Y%m%d%H%i%s') <= '20080229010000'
-
-
Try this and post back if it does not work
This is the error message i got after executing the query.
Incorrect datetime value: '1'.
This is the error message i got after executing the query.
Incorrect datetime value: '1'.
Try this: -
-
SELECT * FROM geo_trip_history WHERE
-
DATE_FORMAT(t.tr_start_date||' '||t.tr_start_time,'%Y%m%d%H%i%s') >=
-
DATE_FORMAT('20080202010000','%Y%m%d%H%i%s') AND DATE_FORMAT(t.tr_end_date||' '||t.tr_end_time,'%Y%m%d%H%i%s') <= DATE_FORMAT('20080229010000','%Y%m%d%H%i%s')
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: netpurpose |
last post by:
I need to extract data from this table to find the lowest prices of
each product as of today. The product will be listed/grouped by the
name only, discarding the product code - I use SUBSTRING(ProductName,
1, CHARINDEX('(', ProductName)-2).
I can get this result, but I had to use several views (totally
inefficient). I think this can be done in one efficient/fast query,
but I can't think of one.
In the case that one query is not...
|
by: Steve |
last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's
criteria is set ats:
Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the
selections are 30, 60 and 90. The default is set at 30.
Question1: When the form opens, there are no records displayed although there
are many records that fit the criteria of 30. If I put a button on the form to
do a requery and press the button, all the records...
|
by: C White |
last post by:
Hi
I am having problems with running a query that does the following
there are 5 fields in a table that the query is based on, the first four
are simple enough and all that happens is that the fields need to match,
for that I was able to do the following to get records out of the
database (does that make sense?)
In (SELECT FROM As Tmp GROUP BY
|
by: Serious_Practitioner |
last post by:
Good day, and thank you in advance for any assistance you can provide.
I have a table in an Access 2000 .mdb file, and I've run into something odd
and insolvable, at least for me. The database is for membership information.
This particular table, called tblMembershipInfo, has fields/columns as
follows -
fldMemNum - Member Number
fldActionDate - The date when the entry was made in that row - Data type is
Date/Time, no format specified
|
by: VMI |
last post by:
I need to display Access data in a datagrid but the Access table has over 2
million records. Since I can't fill a datatable with all those records but
the user needs to see all of them, how can I fill the datatable with a
subset of the initial query result? In the windows Form, under the datagrid,
I was thinking of adding a "Next" button that would display the next N
records from the initial query, and a "Previous" that would display the...
| |
by: Andy_Khosravi |
last post by:
My problem:
I'm having trouble with a query taking much too long to run; a query
without any criteria evaluating only 650 records takes over 300 seconds
to run (over the network. On local drive takes 120 seconds).
The Setup:
I'm running Access 97 non-developer edition. I have exactly zero other
tools to use and no way to change that =(. My database is compiled and
resides on a network drive. The database has not been split into a...
|
by: Stan |
last post by:
I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for June, and will
return all records in that month.
|
by: skbhagour |
last post by:
hi all i am using given below procedure
what i want (i am using sql server2000 with vb.net in window advanceserver2000)
1.i want records between two given date for particular account statement.
2.if record is present in both tables than all the colums of query has value.
3.if not any side than corresponding table columns fill with null and other with
value.
|
by: skbhagour |
last post by:
hi all i am using given below procedure
what i want (i am using sql server2000 with vb.net in window advanceserver2000)
1.i want records between two given date for particular account statement.
2.if record is present in both tables than all the colums of query has value.
3.if not any side than corresponding table columns fill with null and other with
value.
|
by: skbhagour |
last post by:
hi all i am using given below procedure
what i want (i am using sql server2000 with vb.net in window advanceserver2000)
1.i want records between two given date for particular account statement.
2.if record is present in both tables than all the colums of query has value.
3.if not any side than corresponding table columns fill with null and other with
value.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |