473,783 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_publish er 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 2324

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

Similar topics

2
15043
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 using TSQL rather than Enterprise Manager / Design Table. TIA Laurence Breeze
18
9766
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, COUNT(*) AS IOIs and want to ORDER BY 'IOI's'. I have been combing through the BOL, but I don't even know what topic/heading this would fall under. USE INDII SELECT FIXID, COUNT(*) AS IOIs FROM . GROUP BY FIXID
10
2204
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 blue header and footer. Does anyone know how to do? I know I can add float: left; to the content div and it sort of works, but it doesn't seem right either. In this case the content div and the side bar div will no longer stay in their...
10
2230
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 using the following query, but it's not returning dates back in the reverse chronological order: SELECT DISTINCT
1
4665
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 the variable as order-by-parameter like this: create function foo(varchar) RETURNS SETOF test AS '
3
3666
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 statement into a View the columns are returned in the order I specify in the SELECT, but if the same statement is in a UDF (so I can specify a parameter), the columns are not returned in the order specified in statement. I know that relations don't...
3
2813
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 invoke undefined behaviour.
7
4232
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 get an error saying that the I have an Invalid column 'Course_Number'. Not sure why but I am very new to User Defined Functions. Here is what I have so far: CREATE FUNCTION CourseEvalBreakdown (
0
1596
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 Values in TERM_COLUMN: %HOUSE% %CONDO% %APARTMENT% I want to compare the input field to TERM_COLUMN so I can see if there's a match. INPUT-TERM = LARGE HOUSE ON HILL
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10081
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.