Home > database >  Table A and table B combination formula
Table A and table B combination formula

Time:09-30

A table definition formula, B table stores the data every day, every day need to compute the current relative to the variations in the synthesis of A day,

A table form:
0.15 the 2017-4-18
1 YGZ001 000300 sh2 YGZ001 ZD0020QJYH 0.8 2017-4-18
3 YGZ001 12 zs 2017-4-18
0.050.95 the 2017-4-18
4 YGQI02 000300 sh5 YGQI02 53 zs 0.05 2017-4-18
6 YGG007 H00933OH 0.8 2017-4-18
7 YGG007 000012 sh 2017-4-18
0.2
B table form:
6 000012 sh 2017-3-30 2017-4-17 160.1668 16:48:13
15 000012 sh 2017-3-31 2017-4-19 160.1795 13:45:27
1 000300 sh 2017-3-30 2017-4-17 3436.758 16:48:13
11 000300 sh 2017-3-31 2017-4-19 3456.0455 13:45:27
3 000905 sh 2017-3-30 2017-4-17 6375.7437 16:48:13
13 000905 sh 2017-3-31 2017-4-19 6401.6479 13:45:27
16 000906 sh 2017-3-31 2017-4-19 3969.9205 13:45:27
4 000906 sh 3949.5621 2017-3-30 2017-4-17 16:48:13
17 12 zs 2017-3-31 1024.22789126 2017-4-19 13:45:27
8 12 zs 1024.19948025 2017-3-30 2017-4-17 16:48:21
20 52 zs 1151.18970717 2017-3-31 2017-4-19 13:45:27
10 52 zs 1151.15422639 2017-3-30 2017-4-17 16:48:21
53 zs 10024.07297025 7 2017-3-30 2017-4-17 16:48:21
18 53 zs 10024.14506118 2017-3-31 2017-4-19 13:45:27
19 to 59 zs 4409.24925521 2017-3-31 2017-4-19 13:45:27
9 59 zs 4392.63192862 2017-3-30 2017-4-17 16:48:21
5 H00933OH 10426.1091 2017-3-30 2017-4-17 16:48:13
14 H00933OH 10521.5624 2017-3-31 2017-4-19 13:45:27
2 ZD0020QJYH 115.8794 2017-3-30 2017-4-17 16:48:13
115.8862 2017-3-31 2017-4-19 12 ZD0020QJYH 13:45:27

For example, the calculation YGZ001 in the growth of March 31, 2017, 000300 of 3.31 sh data/3.30 * 0.15 + 3.31 ZD0020QJYH data/3.30 * 0.80 + 12 zs data/3.30 * 3.31 0.05;

How to write A single statement to implement this function, because A have A lot of the formula in the table, thank you,





CodePudding user response:

The basic idea is row transfer column
  • Related