Quantcast
Viewing all articles
Browse latest Browse all 6412

Regarding SQL Logic

Hi,

 

I have a requirement as below.

 

I just tried with Select + update ( inner query ) But the only challenge I am facing is how to fetch data for previous row. ie for n column 'B' is blank so get the data from n-1 'B' column and insert the same. Do we need to use the loops here? I am just afraid if we use the same it may hamper the performance of a query. Any suggestion please?

 

Source Table:

 

A          B

ABC     100

ABC     200

DEF    
ABC     600

GHI    

MNO     900

 

 

Target Table:

 

 

A          B

ABC     100

ABC     200

DEF     200   
ABC     600

GHI      600

MNO     900

 

Br

Sumeet


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>