由买买提看人间百态

topics

全部话题 - 话题: pointid
(共0页)
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实现?谢谢各位!
a9
发帖数: 21638
2
update lab set sampleno=b.sampleno from sample a,lab b where a.pointid=b.
pointid and a.top < b.depth and b.depth < a.bottom
(共0页)