Jump to content

Need help.. SQL experts !!!!!


KaNTRhi

Recommended Posts

Aa case statement lo prathi condition ki same value return chesthunnaav kadaa (a.tree_node)? Why?

 

A.tree_node lo ne Tree Level Desc store avuddi (ex: Tree_level_num = 1 then A.tree_node = Account

Tree_level_num = 1= 2 then Cash.. ilaa store avuthayi values.)

Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Asuming ur table name is tabA and columns are id, col1 col2 etc....

 

Select a.id, a. Col1, coalesce(a.col2, b.col2, c.col2....), coalesce(a.col3, b.col3, c.col3...) .....

From

TabA a

Left. Join

TabA b

On a.id = b.id

Left join

TabA c

On a.id = c.id

.

.

.

.

.

Where

B. Col2 is not null

And c.col3 is not null

And d.col4 is not null

.

.

.

;

Assuming ur id is PK

Link to comment
Share on other sites

annay neku oka row ne kavala ayte neku ye columns not null kavalo vatiki max thagilinchi ..ye columns ayte null expect chestunaro avi columns list lo petti vatiki group by thagilinchandi :thinking:

 

Uncle... aa Case when lo elaa isthamu ee values (For each level)??

Link to comment
Share on other sites

Asuming ur table name is tabA and columns are id, col1 col2 etc....

 

Select a.id, a. Col1, coalesce(a.col2, b.col2, c.col2....), coalesce(a.col3, b.col3, c.col3...) .....

From

TabA a

Left. Join

TabA b

On a.id = b.id

Left join

TabA c

On a.id = c.id

.

.

.

.

.

Where

B. Col2 is not null

And c.col3 is not null

And d.col4 is not null

.

.

.

;

Assuming ur id is PK

 

RR uncle.. konchem aa SQL lo ne.. miru paina vesina syntax ki modify chesi ivvavaaa :mellow::wall:

Link to comment
Share on other sites

Ebbey.. theliyanide ga asking :kick::buttkick:

 

Niku thelisthe solution cheppu :atwitsend:

okosaari Pedda rocket kooda chinna bolt sarileka aagipothundhi...inkosaari simple problems ki kooda solutions dorakka ginjukuntam...asumantappudu duppati kappukuni thongunta nenaithe....thellarayye sariki adhe solve aiyyiddi...anxiety disorder ni pakkana etti peaceful mind tho alosinchu solution Nee Pakka llo undiddi..
Link to comment
Share on other sites

Nee table name and column list vai code raasi pamputha

 

 

SELECT D.ACCOUNT, A.TREE_NAME,A.EFFDT,D.DESCR, D.SETID, 

C.range_from , c.range_to, (Tree_node = 1,2,3,4,5,6,7,8,9 as Level_1 to Level_9)
 
FROM PSTREENODE A, PSTREENODE B, PSTREEBRANCH E, PSTREELEAF C, PS_GL_ACCOUNT_TBL D 
 
Criteria:
 
A B C E laki Effdt criteria undi..
 
A.SETID = 'COP'
A.TREE_NAME = 'ACCT' 
and d.account between '101' and '102' 
 
Ivi anni delivered tables.. so niku online lo kooda keys dorukuthai... 
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...