create or replace view clh_temp2 as
select * from
(select a.account_id col1, null col2,null col3, null col4, null col5 from
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) a
union all
select a.*, b.*, null, null, null from
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) a,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) b
union all
select a.*, b.*, c.*, null, null from
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) a,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) b,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) c
union all
select a.*, b.*, c.*, d.*, null from
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) a,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) b,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) c,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) d
union all
select a.*, b.*, c.*, d.*, e.* from
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) a,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) b,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) c,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) d,
(select distinct account_id from journal where acct_year = 2009 and acct_period = 3) e)