Hi,
at first, sorry for my bad english, if you will not understand, tell me and i will try to describe it in another way.
I have a little problem, when I have select with subselect in procedure and i'm trying to walk throught result with cursor and fetch.
Basically, I have a table "robots" where I store data:
ID (Auto increment value for robot identification)
IDaukce ( = ID of auction which is robot related to)
uziv ( = user which is robot related to)
counter (int value, tells me what row for what IDauction will be selected)
And now, I need select for every IDaukce (ID of auction) robot with lowest counter.
For example:
ID:1 | IDaukce:1 | Uziv: John1 | Counter: 1
ID:2 | IDaukce:1 | Uziv: Chuck | Counter: 0
ID:3 | IDaukce:2 | Uziv: Chuck | Counter: 0
So it will select IDaukce 1 and IDaukce 2 and for every IDaukce it will choose row with lowest counter, so the result will be:
ID:2 | IDaukce:1 | Uziv: Chuck | Counter: 0
ID:3 | IDaukce:2 | Uziv: Chuck | Counter: 0
So I maked some select and when I try this in phpMyAdmin, it works fine - it will get some results (more then one).
But when Im trying to walk throught result with CURSOR, it gives me only one row - and it starts doing this when I added subselect.
Can somebody help me?
I think,I have two options how to make it work:
1) make select for getting robots without subselect.
2) figure out, why CURSOR doesn't work with more then 1 row from result.
I pasted here my actual version of PROROCEDURE, which is doing this work.
http://pastebin.com/tPQKELew
(there are more conditions, but in phpMyAdmin it works fine so I dont think, that probleme is in WHERE clause)
I will be glad for every usefull tip or help.
(and again - sorry for english :D )