From: Dirk Jagdmann <jagdmann@gmail.com>
To: d.piekarski@vivawasser.de
Cc: pgsql-sql@postgresql.org
Subject: Re: Add: Special sort querstion
Date: Wed, 1 Apr 2009 07:57:38 -0700
Message-ID: <5d0f60990904010757t1d1dcbbbx1293e95e4850b31e@mail.gmail.com> (raw)
In-Reply-To: <49CCC24A.90800@vivawasser.de>
References: <49CA6121.8090704@vivawasser.de>
<49CCC24A.90800@vivawasser.de>
I think it can not be done with default PostgreSQL functions and
operators, because you must compare two different columns of two rows
depending which row is on either side of the "<" comparision.
But I think you can do this with the following steps:
1) create a new type as a 4-tupel of start_lat, end_lat, start_lng, end_lng.
2) write a comparison function for this type
3) write a SQL-Function to convert 4 values into your new type (for
example: ToMyType(start_lat, end_lat, start_lnd, end_lng) returns
MyType...)
4) use ToMyType in the order clause of your select
If this would work, I'm interested in a working example code :-)
--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jagdmann@gmail.com, d.piekarski@vivawasser.de
Subject: Re: Add: Special sort querstion
In-Reply-To: <5d0f60990904010757t1d1dcbbbx1293e95e4850b31e@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox