d****f 发帖数: 313 | 1 我现在有一个SAMPLE表,结构如下:
POINTID, SAMPLENO, TOP, BOTTOM
FER-01, U-1, 1, 2
FER-01, U-2, 2.1, 3
FER-01, U-3, 3.1, 4
FER-02, U-1, 1, 2
FER-02, U-2, 2.1, 3
FER-02, U-3, 3.1, 4
另外有一个LAB表,结构如下
POINTID, DEPTH, SAMPLENO
FER-01, 1.5, ???
FER-02, 2.5, ???
也就是说要对LAB表中的深度值DEPTH,查对应POINTID的TOP和BOTTOM,看其落在哪个
SAMPLENO的范围内,然后填上SAMPLENO?
感觉若是VBA编程似乎总有办法,但是否可以用sql实现?谢谢各位! |
|