Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to add a weight factor to a query?

Re: How to add a weight factor to a query?

From: <jethro_harding_at_my-deja.com>
Date: Fri, 26 Jan 2001 08:33:25 GMT
Message-ID: <94rcol$79j$1@nnrp1.deja.com>

In article <3A70FF26.6A1EE04C_at_exesolutions.com>,   "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote:
> > In article <3A6FAE32.3AEF8B41_at_exesolutions.com>,
> > "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote:
> > > > How do I add a weight factor to a query? For example, take the
> > > > following query:
> > > >
> > > > SELECT table.field1, table.field2, table.field3
> > > > FROM table
> > > > WHERE field1 = 'value1'
> > > > AND field2 = value2
> > > > OR field3 = value3
> > > >
> > > > What I would like to do now is give each test a factor of
 importance.
> > > > So (field1 = 'value1') should be the most important, let's say
 60%,
 the
> > > > other two should be of importance for 20% each.
> > > >
> > > > Can anybody help me with this? Thanks very much in advance for
 your
> > > > time and effort!
> > >
> > > The only way I know to do this is to create a view or snapshot in
 which you
> > > display the data with the weight factor calculated and then query
 from that
> > > object. You could use a decode to create the values for the
 weight-
 value
> > > field.
> > >
> > > Obviously the SQL for the view or snapshot could be incorporated
 into
 a SQL
> > > query but approaching it in this way (with the view) will make it
 less
> > > complicated to construct or (with the snapshot) run substantially
 faster.
> > >
> > > Hope this helps.
> > >
> > > Daniel A. Morgan
> > >
> >
> > Thanks for your reply, but I don't think that this solves my
 problem.
> > The weight factors added to the query are not calculated, they are
 set
> > values. People who use my software must be able to build a query and
> > enter these weight factors for themselves.
> >
> > Still, thank you for your time and effort!
>
> Don't dismiss me solution so quickly. It still works. You just need  to use
> dynamic SQL to construct the query on the fly. I tried it just now  and it

> works just fine.
>
> Daniel A. Morgan
>

Would you be so kind as to send me an example of your query? I still can't see how to do this properly.

Thank you very much in advance,

Jethro Harding

Sent via Deja.com
http://www.deja.com/ Received on Fri Jan 26 2001 - 02:33:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US