oracle - How to get sql table output using select statement etc -


in oracle sql want output below. column divided row put x , otherwise put blank ..

example::- 1/100 put x if not put blank can using select statement query in sql. if 100 not division 3 put blank..

xyz  1  2  3  4  5  ... --- -- -- -- -- -- 100  ×  ×     ×  × 200  ×  ×     ×  × 300  ×  ×  ×  ×  × 400  ×  ×     ×  × 

its upto n column in database table. upto n column in database table.

its upto n column in database table.

you can using mod(), so:

with sample_data (select 100 xyz dual union                      select 200 xyz dual union                      select 300 xyz dual union                      select 400 xyz dual) select xyz,        'x' "1", -- every number divisible 1        case when mod(xyz, 2) = 0 'x' end "2",        case when mod(xyz, 3) = 0 'x' end "2",        case when mod(xyz, 4) = 0 'x' end "2",        case when mod(xyz, 5) = 0 'x' end "2"   sample_data;         xyz 1 2 2 2 2 ---------- - - - - -        100 x x   x x        200 x x   x x        300 x x x x x        400 x x   x x 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -