I am new to SQL and have been searching for a way to set variables in ANSI SQL. I have this:
select * from table1
where first_date > '2014-01-01'
and where second_date = '2014-01-01'
and where third_date < '2014-01-01'
but I am hoping for something like:
set x = '2010-12-31'
select * from table1
where first_date > x
and where second_date = x
and where third_date < x
I read about stored procedures but it seems like overkill for something so seemingly simple. I'm running on Netezza but I'd like a general solution that can also work on other databases.