473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ORDER BY 5*(column LIKE ' term') + 4*(column LIKE ' term')

I am trying to find some documentation on using things like ORDER BY
5*(column LIKE ' term') + 4*(column LIKE ' term')

I don't even know what it is called so it is difficult to search. My
questions is... Is the value before the * like a multiplier? So I could
give more weight to one column than another by raising that number?

I am trying to return a result that searches 5 or 6 columns and column
1 needs to have by far the most weight, 2 the second amount of weight
and so on. I thought this worked but lets say i am searching for the
word "cooking" like below

Order By 6*(book_title LIKE '%cooking"%') + 5*(book chapter LIKE
'%cooking%') + 4*(book_author LIKE '%cooking%') + 3*(book_text LIKE
'%cooking%') + 2*(book_publisher LIKE '%cooking%') +
1*(book_pulish_date) desc

The problem is if the word "cooking" is in the book_title once, but in
the book_text like 20 times, the book_text is returned first, i always
want the title to have more precedence even if it only contains
"cooking" once.

Thanks for any help.

Chad

Sep 12 '06 #1
0 2304

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Laurence Breeze | last post by:
Is it possible to add a column to a table using the "alter table" statement and specify where in the sequence of columns the new column sits. If not is there any way to alter the order of columns...
18
by: war_wheelan | last post by:
I am very new to Transact-SQL programming and don't have a programming background and was hoping that someone could point me in the right direction. I have a SELECT statement SELECT FIXID,...
10
by: Ed | last post by:
The page I'm working on is at http://www.coldpizzasoftware.com/temp/layout.html I trying to get the yellow sidebar to go in the white area to the right of the green content area and between the...
10
by: OtisUsenet | last post by:
Hello, I am trying to select distinct dates and order them in the reverse chronological order. Although the column type is TIMESTAMP, in this case I want only YYYY, MM, and DD back. I am...
1
by: Thomas Schoen | last post by:
Hi, is it possible to use a parameter of a plpgsql-function to order a selection inside the function? What i would like to do is pass a column-name/alias-name to a plpgsql function and use...
3
by: Beowulf | last post by:
I was just messing around with some ad hoc views and table returning UDFs today so I could look at and print out data from a small table and noticed something strange. If I stick my select...
3
by: andreas ames | last post by:
Hi all, recently I came across a line of code like the following: if seq.erase(seq.begin(), seq.end()) != seq.end() /* ... */ It made me wonder if this is just bogus or if it even can...
7
by: jknaty | last post by:
I'm trying to create a function that splits up a column by spaces, and I thought creating a function that finds the spaces with CHARINDEX and then SUBSTRING on those values would an approach. I...
0
by: ThereYouAre | last post by:
I'm trying to compare input data to what's stored on a DB2 table to see if there's a match, but DB2 stores the term I want to look for in the input field. Table: TERM_TABLE Column: TERM_COLUMN...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.