user5154099
user5154099

Reputation:

Oracle Query compare 2 columns that both have dates and only display the record if column a less than column b

I have Oracle data in which I only want to retrieve the records that have a date from a column that is greater than the date of another column date.

select o.outage_k,o.work_fldr_k,o.crt_d, o.closed_d,o.etr_d from outage o

enter image description here

I was wondering if I want to filter out date in the SELECT or in the WHERE clause?

So a Case Statement?

In the the query I show in the screenshot I would NOT want to return that records BECAUSE ETR_D is greater than Closed_D

So what I want is to return all records in where CLOSED_D > ETR_D

Probably cannot use greater than > symbol as well for date compare

Upvotes: 0

Views: 371

Answers (1)

WW.
WW.

Reputation: 24291

You can just compare the dates in WHERE clause:

WHERE CLOSED_D > ETR_D

Did something not work when you tried that?

Upvotes: 0

Related Questions