0 - 3 of 3 tags for sql help

Hi All,
I have a dataset that looks like this:
ID        start_date    end_date       flag
12345  2014-06-04  2014-07-03    I
12345  2014-07-04  2014-08-14    O
12345  2014-07-04  2014-12-01    O
12345  2014-07-04   2015-03-01   O
12345 2015-03-02   2015-05-01    I
12345 2015-05-02    2899-12-31   I

Hello everyone, I am almost completlely new to teradata a and sql. I am seasoned in C, C++, Java and other languages but not until now started using a database language. Anyways, my question is this; is there a way to create a macro or something similar where given the varialbe var_1 then it would run the correct select stament. Something like this:

Hi All,

I know in Oracle, we can join 2 tables using "USING" Keyword for example

SELECT STUDENT_NAME, DEPARTMENT_NAME FROM STUDENT

JOIN DEPARTMENT USING (DEPARTMENT_ID)

This works fine in Oracle as long as I dont pull out DEPARTMENT_ID in my select statement.