Error: Syntax error: expected something between the word 'a' and '.'

Database

Error: Syntax error: expected something between the word 'a' and '.'

Hi all,

I'm new to Teradata and just started using it a week ago. I have trouble figuring out what is wrong with the following short code:

create table c as

( select a.col_1, a.col_2, sum(a.col_3) as total_col_3, count(a.col_4) as cnt_col_4

from TABLE_A a, TABLE_B b

where a.col_5=b.col_5 and a.col_6=b.col_6

group by 1,2) with data primary index(a.col_5);

Any advice or suggestion would be highly appreciated. Thanks!

8 REPLIES
Enthusiast

Re: Error: Syntax error: expected something between the word 'a' and '.'

You do not have a.col5.

Give an alias to all columns. It is a good way to identify.

Try this, putting a.col1 as PI. You can change later.

create table c as

( select a.col_1 as jj, a.col_2 as kk, sum(a.col_3) as total_col_3, count(a.col_4) as cnt_col_4

from TABLE_A a, TABLE_B b

where a.col_5=b.col_5 and a.col_6=b.col_6

group by 1,2) with data primary index(jj);

Re: Error: Syntax error: expected something between the word 'a' and '.'

Hi Raja_KT, thank you for your help. It solved the problem.
Enthusiast

Re: Error: Syntax error: expected something between the word 'a' and '.'

select a12.xx  xx,
 a12.bb  bb
from (select a11.zz zz,
 CASE WHEN substring(a11.zz ,2,1)  between '0' and '9' THEN substring(a11.zz,1,1)  ELSE substring(a11.zz,1,2) END zz
from table1  a11) a12
group by a12.xx,
 a12.bb

Hi Guys Very helpful post. I am new to Teradata and getting  similar eror with  the above case statement. can yu help please. This is puzzling.

Thanks in advance

Junior Contributor

Re: Error: Syntax error: expected something between the word 'a' and '.'

Your SUBSTRING uses ODBC syntax, which is not valid, it's either substring(a11.zz from 2 for 1) or substr(a11.zz ,2,1)

Enthusiast

Re: Error: Syntax error: expected something between the word 'a' and '.'

thanks a million Dieter. I will test it tomorrow and let you know how it went.

Enthusiast

Re: Error: Syntax error: expected something between the word 'a' and '.'

Hi Dieter. Thanks again.  it fixed the issue.

Enthusiast

Re: Error: Syntax error: expected something between the word 'a' and '.'

I too have the same error and a.col5 is not missing. The code is the same, with an extra case. What could be missing?

Teradata Employee

Re: Error: Syntax error: expected something between the word 'a' and '.'

Please post your code.