jdbcteradata-sql-assistantteradatasql

Getting syntax error in teradata sql query, missing keyword between var and 'NOT'


I'm trying out this query but I'm getting a syntax error, I'm not sure what the correct syntax would be so looking for some help here, the query is shown below:

select
    rg.col_tar,
    count(distinct rg.col_tar)
from ref_table1 rg
full outer join ref_table_2 ad
ON rg.table_prime=ad.table_prime
where (
    (CONCAT(rg.col1,
        rg.col2,
        rg.col3,
        rg.col4))
        as part_addr_ref NOT= (CONCAT(ad.col1,
        ad.col2,
        ad.col3,
        ad.col4))
        as part_addr_before
)

For this query I'm getting the error:

Syntax Error: Expected something between the word 'part_addr_ref' and 'NOT' keyword

Any help would be appreciated thanks!

I tried to join based on where condition but got syntax error


Solution

  • Here is the correct syntax:

    SELECT * 
    FROM PERSONS t01
    FULL OUTER JOIN
    PERSONS t02
    ON
        t01.PERSON_ID = t02.PERSON_ID
    WHERE (
             NOT (CONCAT(t01.FIRST_NAME,t01.LAST_NAME) = 
                  CONCAT(t02.FIRST_NAME,t02.LAST_NAME)
          );