jvsrvcs wrote > I tried that but get an error > v_start_date date; > v_minus_one_year date; > > I have v_start_date to start with and want to subtract one year and put > into v_minus_one_year > > select v_start_date - interval '1 yr' as v_minus_one_year; > > > > --- I get: > > ERROR: query has no destination for result data The relevant section of the documentation you need to study is: http://www.postgresql.org/docs/9.3/interactive/plpgsql-statements.html There are two basic ways to assign to variables: variable := expression SELECT expression[s] INTO variable[s] FROM ... || SELECT expression[s] FROM ... INTO variable[s] Your problem is that: SELECT expression AS "variable" FROM ... simply provides an alias for the expression and has nothing to do with any variables in the surrounding program. The "INTO" keyword is needed to avoid ambiguity. pl/pgsql has the unique behavior that using SELECT without INTO results in an error. If you really need to execute a SELECT and ignore the content selected you have to use PERFORM. The error you saw was this behavior in action. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/subtracting-from-a-date-tp5790891p5790923.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general