当前位置: 动力学知识库 > 问答 > 编程问答 >

Firebird sql select multiple rows

问题描述:

I have a table in Firebird 2.5 like

Point X Y Z

1 100 100 50

2 110 120 50.34

3 145 155 56

How can I make a select query to select point 1 and point 3 with result

point1 P1X P1Y P1Y point2 P2X P2Y P2Z

1 100 100 50 3 145 155 56

网友答案:

What you really want to do is a bit unclear. The following returns the desired results:

select min(point) as point1, min(x) as p1x, min(y) as p1y, min(z) as p1z,
       max(point) as point2, max(x) as p2x, max(y) as p2y, max(z) as p2z
from t;

Alternatively, you might want:

select p1.*, p2.*
from t p1 join
     t p2
     on p1.point = 1 and p2.point = 3;
分享给朋友:
您可能感兴趣的文章:
随机阅读: