I have a column 'customer_date' with datatype text.
Based on the time i need to derive a new column
Condition :
- when customer_date <12 then 'AM' else 'PM
customer_date
01Mar2018 10:03:54
02Mar2018 13:03:54
expected output
customer_date session
01Mar2018 10:03:54 AM
02Mar2018 13:03:54 PM
It throws me error when i wrote
select
case EXTRACT(HOUR FROM customer_date)<12 then 'AM' else 'PM' end as session
from my table;