Try this:

SELECT ST_Distance(a.location, b.location)
FROM points_tbl a, points_tbl b
WHERE a.id = 1000 AND b.id = 3029;

-- Kevin

-------------
Kevin Neufeld
Software Developer
Refractions Research Inc.
300-1207 Douglas St.
Victoria, B.C., V8W 2E7

Phone: (250) 383-3022
Email: [EMAIL PROTECTED]



Chris Jewell wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

So, I need to find the distance between two point referred to by unique IDs.  I 
was
trying to do something like:

SELECT distance((SELECT location FROM points_tbl WHERE id=1000),(SELECT 
location FROM
points_tbl WHERE id=3029));

However, it appears that you cannot supply a query result as the argument to a
function.  I rather suspected this before I started ;-).  Is there another way 
to
return such a distance without having to write a function that copies the 
relevant
location geometries into variables, and then uses the distance function?

Many thanks,

Chris
- --
Chris Jewell, BSc(Hons), BVSc, MRCVS
Dept of Maths and Statistics
Fylde College
Lancaster University
Lancaster
Lancs
LA1 4YF
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG5chZtbYC54ephxMRAhSuAKCvu+Kf3+RWf/L1A6mibRWYsg38sACglPWj
xE8OkX+CabnqZaH/tX/SgSo=
=jgof
-----END PGP SIGNATURE-----
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to