Cannot specify both sql_table_name and derived_table for view

Hi i want to create a derived table using sql in my view only that sql query is a composition of two unions of the same table each time the problem that I encounter is that i get an error. saying that I cannot specify both sql table name and the derived table for a view here is the code if you can help it would much appreciated :

view: s_markets {
sql_table_name: s.markets ;;
drill_fields: [id]

derived_table: {
sql:
SELECT CASE WHEN name__c = 'South Korea' THEN 'Korea South' ELSE name__c END AS markets
FROM s.markets
WHERE office_n IN ('USA', 'Argentina')

UNION
SELECT office_n AS office
FROM s.markets

UNION
SELECT w_r AS continent
FROM s.markets
}
0 1 361
1 REPLY 1

Remove the sql_table_name from your view definition. You either map the whole table (sql_table_name) or tell Looker to execute sql (derived_table) and build a table from that SQL. 

Top Labels in this Space
Top Solution Authors