0

I want to select all of the rows added to a table which were added "yesterday" i.e. the day before whenever I choose to run the query.

At the moment my query looks like this:

SELECT row_date (etc)
WHERE  row_date >= trunc(sysdate-1)
       and row_date < truc(sysdate);

Is there a more efficient (and, hopefully, readable) way of achieving this?

Cheers,

Pete

1 Answers1

2

That query doesn't look like it can be optimised to me. You've made it sargable by avoiding wrapping the column itself in any date/time functions.

Do you have an index on row_date?

Community
  • 1
  • 1
Martin Smith
  • 438,706
  • 87
  • 741
  • 845