Query between two times in redshift

This is something I do regularly, wanting to look at log activity over a 30 minute range

Use datediff and “mins” datepart like this

(datediff(mins,’2016-05-04 15:50′,DATE) between 0 AND 30)

This looks at a 30 minute window around 16:00 hrs

Simple really

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s