Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Help with manipulating data from a database??

by archfool (Monk)
on Jul 02, 2007 at 13:55 UTC ( [id://624447]=note: print w/replies, xml ) Need Help??


in reply to Help with manipulating data from a database??

Two SQL queries.
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) }
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. :(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://624447]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 11:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found