0

I have a database stored in Amazon Redshift and an array is stored in table column in JSON format.

How to fetch a string from array?

2 Answers 2

2

Using json_extract_path_text you can retrieve values from a column In Redshift database I have JSON in one column
This query performs join and to get seperate column results.

SELECT json_extract_path_text(O._doc,'domain') AS Domain, 
       json_extract_path_text(P._doc,'email') AS Email
FROM   intelligense_mongo.organisations AS O
INNER JOIN    intelligense_mongo.people AS P
ON  json_extract_path_text(O._doc,'_id') = 
    json_extract_path_text(P._doc,'organisation_id')
Where 
json_extract_path_text(O._doc,'tools_name') = '%"WordPress"%'
Sign up to request clarification or add additional context in comments.

Comments

2

Use the JSON_EXTRACT_PATH_TEXT Function:

select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"star"}}','f4', 'f6');

json_extract_path_text
---------------------- 
star 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.