|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Sql or Sybperl advice needed
Date: Jun 18 2002 2:48PM
On Tue, 2002-06-18 at 07:27, Lee Wenzler wrote:
> Sybperl hash advice needed:
>
>
>
> I'm using Sybase::Simple and need a method of selecting a row from a
> table used to translate from one system to another where there are
> matches of one more columns, but I want the row that has the most
> matches (I'm hoping to use some type of hash table for this). All of
> the source columns can have null (don't care) values too. For example,
> with a table that has these columns:
The solution that I'd use would probably depend on how many rows match
the minimal condition (i.e. a / b not null, or d/e not null if I
understand correctly).
If the number of rows is relatively small I might load the minimal
condition to a hash or array of some sort, and then find the entry that
matches my condition.
You could also write a stored procedure that does this for you, but that
would have to iteratively query the table until it got a hit, I think.
Maybe someone else has a better idea on how to solve this sort of
problem...
Michael
--
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!
|