MySQL Forums
Forum List  »  Newbie

Help with SELECT in function
Posted by: Joakim Kring
Date: June 10, 2015 07:25AM

Hi.
This is driving me nuts and I can't figure out what the problem is.

The table openset is a temporary table created by the function
Name	f_score	g_score	x	y	z
C	5.3	3.5	71	49	69
D	3.2	3.5	72	48	70
L	6.6	3.5	72	48	68
R	9.4	3.5	75	48	75
Z	12.3	3.5	80	48	69
The query should return the row with the lowest f_score which is D

SELECT `Name`, `f_score`,`x`,`y`,`z` INTO current,f_score,cx,cy,cz FROM `openset` ORDER BY `f_score` LIMIT 1;

This works fine when I run it from the prompt but when I use it in a function it always returns the first item in the table, C.

It is like no sorting takes place and it just returns the first item.

Options: ReplyQuote


Subject
Written By
Posted
Help with SELECT in function
June 10, 2015 07:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.