Reputation: 1
I'm having trouble selecting the following from a postgres database.
ERROR: syntax error at or near "AS"
LINE 33: dv.Creative_Size AS "Ad_Format",
SELECT(
dv.Advertiser,
dv.Advertiser_ID,
dv.Advertiser_Currency,
dv.Insertion_Order,
dv.Line_Item,
dv.Ad_Date,
dv.Device_Type,
dv.Environment,
dv.Creative_Size AS "Ad_Format",
dv.Impressions,
dv.Clicks,
dv.Total_Conversions,
dv.Revenue,
dv.First_Quartile_Views,
dv.Midpoint_Views,
dv.Third_Quartile_Views,
dv.Complete_Views,
dv.Viewable_Impressions,
dv.Measureable_Impressions
)
FROM master_data_dv360 AS dv;
The create statement for this table is (don't worry this is an intermediary table for importing from a CSV file):
CREATE TABLE master_data_dv360(
Advertiser varchar,
Advertiser_ID varchar,
Advertiser_Currency varchar,
Insertion_Order varchar,
Insertion_Order_ID varchar,
Line_Item varchar,
Line_Item_ID varchar,
Ad_Date varchar,
Device_Type varchar,
Environment varchar,
Creative_Size varchar,
Floodlight_Activity_Name varchar,
Floodlight_Activity_ID varchar,
Impressions varchar,
Billable_Impressions varchar,
Clicks varchar,
Click_Rate varchar,
Total_Conversions varchar,
Post_Click_Conversions varchar,
Post_View_Conversions varchar,
Revenue varchar,
Media_Cost varchar,
First_Quartile_Views varchar,
Midpoint_Views varchar,
Third_Quartile_Views varchar,
Complete_Views varchar,
Viewable_Impressions varchar,
Measureable_Impressions varchar,
CM_Post_Click_Revenue varchar,
CM_Post_View_Revenue varchar
);
Upvotes: 0
Views: 109
Reputation: 247235
The parentheses in your SELECT
list are interpreted as a row constructor:
The key word
ROW
is optional when there is more than one expression in the list.
So your query returns only a single (composite) value, and you could only add an alias after the closing parenthesis.
But I assume that the parentheses are there by mistake: if you remove them, your query will not cause the error any more.
Upvotes: 1