Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>not sure where you're going to get your data for the all_mnth, so you should figure that out first. Let us know and then joining that in woth zero values should be easy. below is my test query up through problem 1 (similar to @Dan A. I "created" a market "table"):</p> <pre><code>with brokers as ( select 'Broker1' company, 9 tran_type_cd, 1000 curr_mnth, 1500000 all_mnth from dual union select 'Broker1' company, 3 tran_type_cd, 50000 curr_mnth, 2500000 all_mnth from dual union select 'Broker1' company, 4 tran_type_cd, 80000 curr_mnth, 8500000 all_mnth from dual union select 'Broker1' company, 1 tran_type_cd, 35000 curr_mnth, 3500000 all_mnth from dual ) , tran_type_cd_expl as ( select 1 TRAN_TYPE_CD, 'STOCKS_SELL' TRAN_TYPE_CD_EXPLD from dual union select 2 TRAN_TYPE_CD, 'STOCKS_BUY' TRAN_TYPE_CD_EXPLD from dual union select 3 TRAN_TYPE_CD, 'GOLD_SELL' TRAN_TYPE_CD_EXPLD from dual union select 4 TRAN_TYPE_CD, 'GOLD_BUY' TRAN_TYPE_CD_EXPLD from dual union select 5 TRAN_TYPE_CD, 'SILVER_SELL' TRAN_TYPE_CD_EXPLD from dual union select 6 TRAN_TYPE_CD, 'SILVER_BUY' TRAN_TYPE_CD_EXPLD from dual union select 7 TRAN_TYPE_CD, 'COPPER_SELL' TRAN_TYPE_CD_EXPLD from dual union select 8 TRAN_TYPE_CD, 'COPPER_BUY' TRAN_TYPE_CD_EXPLD from dual union select 9 TRAN_TYPE_CD, 'CURRENCY_SELL' TRAN_TYPE_CD_EXPLD from dual union select 10 TRAN_TYPE_CD, 'CURRENCY_BUY' TRAN_TYPE_CD_EXPLD from dual ) , market as ( select 'CURRENCY_BUY' tran_type_cd_expld, 'FOREX' market from dual union select 'CURRENCY_SELL' tran_type_cd_expld, 'FOREX' market from dual union select 'GOLD_BUY' tran_type_cd_expld, 'CONTRACTS' market from dual union select 'GOLD_SELL' tran_type_cd_expld, 'CONTRACTS' market from dual union select 'STOCKS_BUY' tran_type_cd_expld, 'STOCKMARKET' market from dual union select 'STOCKS_SELL' tran_type_cd_expld, 'STOCKMARKET' market from dual ) select company, market, t.tran_type_cd_expld tran_type, curr_mnth, all_mnth from brokers b, tran_type_cd_expl t, market m where b.tran_type_cd = t.tran_type_cd and t.tran_type_cd_expld = m.tran_type_cd_expld ; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload