Need Help with Simple SQL query [message #374188] |
Tue, 29 May 2001 22:17 |
Greg
Messages: 35 Registered: July 2000
|
Member |
|
|
We use simple SQL queries to extract data from our Oracle Exchange database.
Theres this table with a 'creation_date' column containing date and time data like 2001-05-25 12:53:21.0
I want to extract some other columns together with this one but only data within a 'creation_date' range.
I tried using this several queries like:
select
order_number, creation_date
from
pom_order_headers
where
creation_date
between
2000-12-28 00:00:00.0
and
2001-05-25 00:00:00.0
------ using this I got a "missing keyword" error message
i also tried:
select
order_number, CREATION_DATE
from
pom_order_headers
where
creation_date
between
"2000-12-28 00:00:00.0"
and
"2001-05-25 00:00:00.0"
---but I got an "invalid column name" button
I also tried using # to enclose the date in time but the oracle sql engine doesnt recognize that character
how should I modify this script?
|
|
|
|
|
|
Re: Need Help with Simple SQL query [message #374221 is a reply to message #374198] |
Thu, 31 May 2001 01:24 |
Zakk
Messages: 5 Registered: May 2001
|
Junior Member |
|
|
instead of defining the datatype of the date column as "DATE" define it as varchar2 when you make the table..Same goes for time. Check it out. And then when you enter the query run it as:
Select * from (table_name)
where
date < (your greater date value, for eg:30may2001)
and
date >(your lesser date value, for eg:25may2001);
TRY IT.
I tried it once on a similar problem and it worked!!!
|
|
|
|
|