I'm sure some SQL guru can wrap this all into one SQL query. In Oracle, you could use PL/SQL to get this, too. But even in pure SQL you should be able to do this without a loop. I'm just not an SQL guru. :(SELECT DISTINT service_ID from ..... Fetch into array and loop... foreach (serviceID) { SELECT stop_reference, distance from XXX WHERE service_ID = :p1 AND distance = (SELECT min(distance) from XXX where service_id = : +p1) }
In reply to Re: Help with manipulating data from a database??
by archfool
in thread Help with manipulating data from a database??
by Harch84
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |