I have this table

With a simple query says;

Consecutivo ID_Periodo ID_Mes
-----------------------------
14              9       5
15              9       5
16              9       5
17              9       5
18              9       5
22              9       5
26              9       5
27              9       5
28              9       5
29              9       5
30              9       5


With simple inverse order on Consecutuvo says:

Select Consecutivo, ID_Periodo, ID_Mes From Asientos_Maestro Where ID_Periodo=9 and ID_Mes=5 And Consecutivo<17 Order By Consecutivo DESC

Consecutivo ID_Periodo ID_Mes
-----------------------------
16              9       5
15              9       5
14              9       5


With simple inverse order on Consecutivo and adding a TOP 1 or ROWNO<=1 says:


Select Consecutivo, ID_Periodo, ID_Mes From Asientos_Maestro Where ID_Periodo=9 and ID_Mes=5 And Consecutivo<17 And ROWNO<=1 Order By Consecutivo DESC

Consecutivo ID_Periodo ID_Mes
-----------------------------
14              9       5



I think that the correct result must be:

Consecutivo ID_Periodo ID_Mes
-----------------------------
16              9       5




What is the problem?


-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to