Alternate for WITH in MYSQL

31 views Asked by At

I am converting my code from AWS athena to MYSQL format.i have with in my code which is not supported by my version of workbench. What can be the alternative .

create view t AS (
    SELECT contract_id, meteraccount_id, bill_start_date, bill_end_date,
    if(position(';156='in attribute_list) > 0, SUBSTRING_INDEX((SUBSTRING_INDEX(attribute_list, '156=', -1)),';',1) , '') as rate_code,
  replace(bill_metrics, 'BillDetails:', '') as bill_metrics
   from pge_prod.accountbillinglog
  where  batchid in ('1680801277741') 
),

x as (
    select contract_id, meteraccount_id, bill_start_date, bill_end_date, rate_code, t.value FROM t
CROSS JOIN  UNNEST(split(t.bill_metrics, ',')) as t(value)
....end as value
from x
) 

I tried creating view

0

There are 0 answers