Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Querying for existing set of values

$
0
0

HI,

I have the following scenario. I have one table which has the measure_id,measure_value and date.

For every date, I will be populating the measure_value for every measure_id. 

If the source, doesnt have the value for a day,for a measure_id, I should update it with 0.

If the source gets fresh data for a date, then the related value should get updated(sum of values for that day) or inserted.(incremental)

DATE MeasureID MeasureValue

02/01  1 10

02/01  2 20

02/01  3 30

02/02  1 10

02/02  2 0(no data in source)

02/02  3 30

Can you please give me the best query for this scenario. Any help is appreciated.



Porus


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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