Reputation: 65
I'm using Redshift and is trying to add a certain string into string into selection result set.
I took the link below as reference and tried exactly the same thing, but it did not work.
adding string to a select statement to include in result set
Would appreciate if anyone could provide a hint.
SELECT p.Name AS title,
p.meta_desc AS description,
p.product_Id AS id,
'new' AS `condition`
FROM products AS p
Error message:
Upvotes: 0
Views: 479
Reputation: 11082
In Redshift column names are quoted by double quotes ("). It may be that condition is a reserved word and needs quotes.
SELECT p.Name AS title,
p.meta_desc AS description,
p.product_Id AS id,
'new' AS "condition"
FROM products AS p
Please post the error message if this doesn't work.
Upvotes: 1
Reputation: 141
in tsql must use ' character instead of ` character
SELECT p.Name AS title,
p.meta_desc AS description,
p.product_Id AS id,
'new' AS 'condition'
FROM products AS p
or without ' character
SELECT p.Name AS title,
p.meta_desc AS description,
p.product_Id AS id,
'new' AS condition
FROM products AS p
Upvotes: 1