in reply to [OT] Weighted Search Results
I think something like this will work. Warning - really untested.
(how's that for a perl fig leaf? ;-)my $sql = <<ESQL; SELECT *, (name = 'Greg') + (age = 32) + (state = 'TX') AS score FROM datable WHERE score > 0 ORDER BY score DESC ESQL
Update: What was I thinking of? This looks much better,
You lose the score information and ordering, but that can be recovered in perl. You gain placeholders! as well as WHERE clause optimizations mentioned in replies.my $sql = <<ESQL; SELECT * FROM datable WHERE ((name = ?) + (age = ?) + (state = ?)) > 0 ESQL
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: [OT] Weighted Search Results
by eric256 (Parson) on May 20, 2004 at 16:12 UTC | |
by CiceroLove (Monk) on May 20, 2004 at 17:36 UTC | |
by eric256 (Parson) on May 20, 2004 at 17:56 UTC |