All Forums Analytics
benjamin.porter 1 post Joined 10/12
21 Nov 2012
SQL works fine in Teradata SQL assistant getting error when trying to execute in Tableau custom SQL connection

Hello,
I have a SQL script that works fine in Teradata SQL assistant, but when I try in bring it into Tableau custom SQL connection, I get a "All expressions in a derived table must have an explicit name" error.  I *think* this has something to do with the FROM clause, but my chops are not good enough to be sure.  Any help is greatly appreciated.
 
 

sel

EXTRACT(MONTH FROM b.date_application_received) || '_' || EXTRACT(YEAR FROM b.date_application_received),

b.APPLICATION_STATUS, count(b.APPLICATION_ID)

 

from pedw.vs_vstr_refrer_actvy c

inner join ud215.cia_master b 

on (c.web_vstr_trkg_id = B.tracking_id)

 

where c.web_actvy_dt between '2011-07-01' and '2012-06-30' 

 and (

  c.extrnl_refrer_txt LIKE 'facebook.com'  

  OR c.extrnl_refrer_txt LIKE 'youtube.com' 

  OR c.extrnl_refrer_txt LIKE 'linkedin.com' 

  OR c.extrnl_refrer_txt LIKE 'delicious.com' 

  OR c.extrnl_refrer_txt LIKE 't.co' 

  OR c.extrnl_refrer_txt LIKE 'social.captl1.co' 

  OR c.extrnl_refrer_txt LIKE 'twitter.com' 

  OR c.extrnl_refrer_txt LIKE 'adf.ly' 

  OR c.extrnl_refrer_txt LIKE 'stumbleupon.com' 

  OR c.extrnl_refrer_txt LIKE 'captl1.co' 

  OR c.extrnl_refrer_txt LIKE 'reddit.com' 

  OR c.extrnl_refrer_txt LIKE 'pinterest.com' 

  OR c.extrnl_refrer_txt LIKE 'bit.ly' 

     OR c.extrnl_refrer_txt LIKE 'fb.me')

     AND (c.EXTRNL_CMPGN_ID LIKE '%_FB%' OR c.EXTRNL_CMPGN_ID LIKE '%_FAB%' OR c.EXTRNL_CMPGN_ID LIKE '%_FAC%' OR c.EXTRNL_CMPGN_ID LIKE '%_YT%' OR c.EXTRNL_CMPGN_ID LIKE '%_ SBCDSP%') 

  AND c.dmn_cntry_cd LIKE 'USA'

group by 1,2 

Tags:
Qaisar Kiani 337 posts Joined 11/05
21 Nov 2012

Try assigning alias names to the first column in your SELECT statement...

SEL
EXTRACT(MONTH FROM b.date_application_received) || '_' || EXTRACT(YEAR FROM b.date_application_received) as month_year,
b.APPLICATION_STATUS, count(b.APPLICATION_ID)
....
....

 

You must sign in to leave a comment.