Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

creating a sort column

2 posts in General Discussion Last posting was on 2005-05-24 11:06:43.0Z
Chris Werner Posted on 2005-05-24 09:40:15.0Z
From: "Chris Werner" <cw{please_no_spam}ATf-s.de>
Newsgroups: ianywhere.public.general
Subject: creating a sort column
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Original-NNTP-Posting-Host: 62.8.156.42
Message-ID: <4292f67b@forums-2-dub>
X-Original-Trace: 24 May 2005 02:40:11 -0700, 62.8.156.42
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 24 May 2005 02:40:13 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 24 May 2005 02:40:15 -0700
X-Trace: forums-1-dub 1116927615 10.22.108.75 (24 May 2005 02:40:15 -0700)
X-Original-Trace: 24 May 2005 02:40:15 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4495
Article PK: 8304

Hi,

I want to create a sort column in a table which contains
distances between pairs of objects. Indeed, creating
the column is easy, the problem is to fill it with correct
data. The table looks like follows:

id1 numeric(15) // ID of object 1
id2 numeric(15) // ID of object 2
dist numeric(14, 3) // Distance
sort numeric(6) // Sequence of the distances

and the column SORT must reflect the sequence
and position of distances for a given ID1 starting
with 1 for the minimal distance.

TIA

Chris Werner


Glenn Paulley Posted on 2005-05-24 11:06:43.0Z
Newsgroups: ianywhere.public.general
Subject: Re: creating a sort column
From: Glenn Paulley <paulley@ianywhere.com>
References: <4292f67b@forums-2-dub>
Organization: iAnywhere Solutions
Message-ID: <Xns966048581890paulleyianywherecom@10.22.241.106>
User-Agent: Xnews/5.04.25
NNTP-Posting-Host: vpn-dub-049.sybase.com
X-Original-NNTP-Posting-Host: vpn-dub-049.sybase.com
Date: 24 May 2005 04:06:43 -0700
X-Trace: forums-1-dub 1116932803 10.22.120.49 (24 May 2005 04:06:43 -0700)
X-Original-Trace: 24 May 2005 04:06:43 -0700, vpn-dub-049.sybase.com
Lines: 50
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4496
Article PK: 8302

"Chris Werner" <cw{please_no_spam}ATf-s.de> wrote in
news:4292f67b@forums-2-dub:

> Hi,
>
> I want to create a sort column in a table which contains
> distances between pairs of objects. Indeed, creating
> the column is easy, the problem is to fill it with correct
> data. The table looks like follows:
>
> id1 numeric(15) // ID of object 1
> id2 numeric(15) // ID of object 2
> dist numeric(14, 3) // Distance
> sort numeric(6) // Sequence of the distances
>
> and the column SORT must reflect the sequence
> and position of distances for a given ID1 starting
> with 1 for the minimal distance.
>
> TIA
>
> Chris Werner
>
>
>

You need to define a function that gives you the specific "sort" value
you want for any particular row. I cannot discern from your description
above precisely what the function is, because I'm precisely sure on what
you mean (but perhaps I'm still short on this morning's coffee).

In any event: if the parameters to the function include only values for
the *current* row, then I would suggest using a COMPUTEd column to fill
in the specific sort values. My guess, however, is that such a function
will be insufficient because you'll want to compare dist values for
different rows with the same value as id1. In that case, I would use an
INSERT TRIGGER to determine the correct value for the sort field.

--
Glenn Paulley
Research and Development Manager, Query Processing
iAnywhere Solutions Engineering

EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288