I am trying to query based on a specific date. For example:
select name, dept, dateofhire
where date of hire >= 12/31/2010
group by name, dept, dateofhire
I regularly get results that contain dates of hire before 12/31/2010.
I've even tried casting the date to match a specific format:
where cast(cast(dateofhire as format 'mm-dd-yy') as varchar(15)) >= '12-31-10'
but to no avail.
Summary: my goal is to query using a date as a parameter but cannot seem to make it work.
What am I missing here?
There's only one recommended way to write a date using Standard SQL syntax:
where dateofhire >= DATE '2010-12-31'