Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

query to return specific date from teradata timestamp(6)

Tags:

sql

teradata

How can i search for a particular date for eg: '2013-10-22' from teradata timestamp(6) field?

sel * from table A
where date = '2013-10-22';

I tried the above query which is throwing error. Please help!

like image 433
RRR Avatar asked Oct 22 '13 16:10

RRR


2 Answers

You may try like this:-

sel * from table A
where date = date '2013-10-22';

Since in ANSI standard form (must be preceded by the keyword DATE)

Check out this

like image 183
Rahul Tripathi Avatar answered Nov 15 '22 11:11

Rahul Tripathi


And more formally:

select * 
from table A
where cast(timestamp_column as date) = date '2013-10-22';

I'm guessing that you were just showing an example, because I don't think you can have a column named date; it's a reserved word. The keyword "date" above is how you specific an ANSI date constant and is not related to the "date" function.

like image 1
BellevueBob Avatar answered Nov 15 '22 12:11

BellevueBob