Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to add a weight factor to a query?
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!
Jethro Harding
Sent via Deja.com
http://www.deja.com/
Received on Thu Jan 25 2001 - 07:10:43 CST