Need Help: Proc SQL join on Teradata

Accepted Solution Solved
Reply
New Contributor Yen
New Contributor
Posts: 4
Accepted Solution

Need Help: Proc SQL join on Teradata

%let mon_tab=%sysfunc(intnx(month, %sysfunc(today()), -13), YYMMN.);

%put &mon_tab.;

%let dt1 = %sysfunc(intnx(month,%sysfunc(today()),-13,beg),MMDDYYD10.);

%let dt2 = %sysfunc(intnx(month,%sysfunc(today()),-13,end),MMDDYYD10.);

%put "&dt1"d. "&dt2"d.;

proc sql;

connect to teradata(user="&username." password="&dbpass" tdpid=aprtera mode=teradata);

create table test as

select * from connection to teradata(

(select a.col1

,sum(b.col2) as tran_sum

from lib1.table1 a right join

(select b.col1, sum(b.col2) as sum_col2 from lib2.table2 b

where b.col3 between "&dt1" and "&dt2" ) c on a.col1=b.col1

group by a.col1

order by a.col1 asc));

disconnect from teradata;

quit;

 

ERROR: Teradata prepare: Column 02-01-2016 not found in lib2.b.

 

Question:

How should those date ranges need to be formatted to avoid error? I am new to teradata database.

 

 

 


Accepted Solutions
Solution
‎03-29-2017 03:26 PM
Valued Guide
Posts: 2,174

Re: Need Help: Proc SQL join on Teradata

beware different assumptions in teradata sql, where strings in double quotes are assumed to be column names, like name literals in SAS when validvarnam= any

View solution in original post


All Replies
Solution
‎03-29-2017 03:26 PM
Valued Guide
Posts: 2,174

Re: Need Help: Proc SQL join on Teradata

beware different assumptions in teradata sql, where strings in double quotes are assumed to be column names, like name literals in SAS when validvarnam= any
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 103 views
  • 0 likes
  • 2 in conversation