mysql - I would like to find goes up by one and falls by one. Use SQL -
mysql - I would like to find goes up by one and falls by one. Use SQL -
i think problem 1 week.
anyway.i find goes 1 , falls one. utilize sql.
for illustration
this table exists.
name: valtable no val 1 → 2 2 → 3 3 → 2 4 → 4 5 → 3 6 → 3 7 → 4 8 → 3 9 → 2 10 → 0
two points applied.
① no.1-3 → 2,3(+1),2(-1) ② no.6-8 → 3,4(+1),3(-1)
is carrying out using sql possible? (oracle, posgresql, mysql
) plenty if first number known.
or please advice should alter table construction ,
select t1.val first, t2.val second, t3.val 3rd test t1 bring together test t2 on t2.no = t1.no + 1 , t2.val = t1.val + 1 bring together test t3 on t3.no = t2.no + 1 , t3.val = t1.val
http://www.sqlfiddle.com/#!2/02685/7
mysql sql oracle postgresql
Comments
Post a Comment