Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3724

update with select query (no replies)

$
0
0
Hi all, I need to calculate a lag variable @b and then update this into my RatesTable. Any ideas, I was sure this would work but the value IncenRate updates to null. it is like @b variable does not have a value but it reports the correct value in the select return. Any help is appreciated

Glenn

select
@b:=(RT1.mtg30 * .25) + (RT2.mtg30 * .5) + (RT3.mtg30 * .25)


from
RatesTable RT

left join
RatesTable RT1
on
date_add(RT1.period, interval 1 month) = RT.Period

left join
RatesTable RT2
on
date_add(RT2.period, interval 2 month) = RT.Period

left join
RatesTable RT3
on
date_add(RT3.period, interval 3 month) = RT.Period;

update RatesTable set IncenRate = @b;

Viewing all articles
Browse latest Browse all 3724

Trending Articles



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