Home > Back-end >  How to use the SQL statement to achieve: a search field of the next row record value minus the value
How to use the SQL statement to achieve: a search field of the next row record value minus the value

Time:11-06

How to use the SQL statement to achieve: a search field of the next row record value minus the value of one row of poor?

Working income
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
100, 5000,
100, 6000,
100, 5600,
101, 5000,
101, 6000,
101, 5600,

Want to get the following results:
Poor job number
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
100/5000/head row for the original value of the
100/1000/6000-5000=1000
100-400//5600-6000=400
101/5000/head row for the original value of the
101/1000/6000-5000=1000
101-400//5600-6000=400

CodePudding user response:

Use vernier can be realized, the table structure design has a problem, you only work number, poor, not suitable, use ordey by, which reduced after reduction first?
  • Related