Reputation: 305
i have table like this:
testtime
4:6:7
11:2:8
how can i extract the minute and second from the string? i want something like this:
testtime minute second
4:6:7 6 7
11:2:8 2 8
thanks
Upvotes: 0
Views: 268
Reputation: 734
You can use Impala's SPLIT_PART
function to do this pretty easily:
SELECT SPLIT_PART("4:6:7", ":", 2),
SPLIT_PART("11:2:8", ":", 2)
You just need to feed the function an input string, delimiter, and field number within the newly delimited string.
Upvotes: 1