I have the following table1
with attribute co
:
|-----------------------------------------
| co
|-----------------------------------------
| fsdsdf "This one" fdsfsd ghjhgj "sfdsf"
| Just This
|-----------------------------------------
In case there are quotation mark - I would like to get the first occurrence content. If there is no quotation mark I would like to return the content as is.
For the above example:
For the first line - This one
For the second line - Just This
I have SQL code in Impala that solves the first case:
select regexp_extract (co, '"([^"]*")',1) from table1
How can I generalize it to detect and return the required results for the next case?