SQL Language (MOSC)

MOSC Banner

Formatting the SQL Query Result

edited Jul 12, 2010 8:07AM in SQL Language (MOSC) 6 commentsAnswered
Hi,

This is the o/p for the below query: I want to display all Balance values in one single row since the GL_CODE is same.

GL_CODE      AFS_BAL    USD_BAL    EUR_BAL    GBP_BAL
--------- ---------- ---------- ---------- ----------   ----------------    ----------------
LB1503000    316330.38
LB1503000                                                  126000
LB1503000                            466380.16


select gl_code,
CASE
 WHEN (gl_code like 'AS%' or gl_code like 'EX%') AND ccy_code = 'AFS'
  THEN dr_bal_lcy-cr_bal_lcy
 WHEN (gl_code like 'LB%' or gl_code like 'IN%') AND ccy_code = 'AFS'
  THEN cr_bal_lcy-dr_bal_lcy
END AFS_BAL,
CASE
 WHEN (gl_code like 'AS%' or gl_code like 'EX%') AND ccy_code = 'USD'

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center