0
我想从没有添加标识列的行位置添加列的查询返回值。我不想在表中的绝对位置,但在查询结果中的位置返回选择查询与行数
假设我有这样的
My_TBL
-----------------------
FLD_A FLD_B FLD_C
a A t
b B t
c C p
d D p
.. ..
,并选择查询的表是
select FLD_A,FLD_B from My_Tbl where FLD_C='p'
FLD_A FLD_B
-----------------------
c C
d D
什么我有在Db2中添加我的查询来获得每个行在该输出计数?
POS FLD_A FLD_B
-----------------------
1 c C
2 d D
检查此问题http://stackoverflow.com/questions/1079480/how-to-determine-position-of-row-in-sql-result-set,我希望这会回答你的问题。 – Torukmakto