Firebird sql select 多行
Firebird sql select multiple rows
我在 Firebird 2.5 中有一个 table 喜欢
Point X Y Z
1 100 100 50
2 110 120 50.34
3 145 155 56
如何对 select 点 1 和点 3 进行 select 查询,结果为
point1 P1X P1Y P1Y point2 P2X P2Y P2Z
1 100 100 50 3 145 155 56
您真正想要做什么有点不清楚。以下returns想要的结果:
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;
或者,您可能需要:
select p1.*, p2.*
from t p1 join
t p2
on p1.point = 1 and p2.point = 3;
我在 Firebird 2.5 中有一个 table 喜欢
Point X Y Z
1 100 100 50
2 110 120 50.34
3 145 155 56
如何对 select 点 1 和点 3 进行 select 查询,结果为
point1 P1X P1Y P1Y point2 P2X P2Y P2Z
1 100 100 50 3 145 155 56
您真正想要做什么有点不清楚。以下returns想要的结果:
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;
或者,您可能需要:
select p1.*, p2.*
from t p1 join
t p2
on p1.point = 1 and p2.point = 3;