Search
 
SCRIPT & CODE EXAMPLE
 

SQL

select A from B join C as D using E where F match G order by H desc

-- This table stores the static weight assigned to each document in FTS table
-- "documents". For each row in the documents table there is a corresponding row
-- with the same docid value in this table.
CREATE TABLE documents_data(docid INTEGER PRIMARY KEY, weight);

-- This query is similar to the one in the block above, except that:
--
--   1. It returns a "snippet" of text along with the document title for display. So
--      that the snippet function may be used, the "WHERE ... MATCH ..." clause from
--      the sub-query is duplicated in the outer query.
--
--   2. The sub-query joins the documents table with the document_data table, so that
--      implementation of the rank function has access to the static weight assigned
--      to each document.
SELECT title, snippet(documents) FROM documents JOIN ( 
    SELECT docid, rank(matchinfo(documents), documents_data.weight) AS rank
    FROM documents JOIN documents_data USING(docid)
    WHERE documents MATCH <query>
    ORDER BY rank DESC 
    LIMIT 10 OFFSET 0
) AS ranktable USING(docid)
WHERE documents MATCH <query>
ORDER BY ranktable.rank DESC
Comment

PREVIOUS NEXT
Code Example
Sql :: copy table structure from postgresql to mysql 
Sql :: oracle factorial 
Sql :: update mysql from paypal shopping cart and ipn 
Sql :: Selecting data from table where sum of values in a column equal to the value in another column 
Sql :: AddEntityFrameworkSqlite 
Sql :: ORA-32794: cannot drop a system-generated sequence 
Sql :: how to know if table in rigt or left in sql 
Sql :: ora 00001 error catch plsql 
Sql :: mysql where in keep order 
Sql :: get all tables with column name sql 
Sql :: how to install sql server 
Sql :: subquery in select 
Sql :: SQL LIKE With Wildcards 
Sql :: SQL Creating a Procedure 
Sql :: postgresql allow remote connections 
Sql :: sql int size 
Sql :: tsql utf to local time 
Sql :: kill mysqld_safe process mariadb 
Csharp :: oncollisionenter is declared but never used 
Csharp :: c# hello world program 
Csharp :: Point to mouse 2D Unity 
Csharp :: check version of asp.net core 
Csharp :: How to read SQL Server COUNT from SqlDataReader 
Csharp :: Getting data from selected datagridview row and which event 
Csharp :: degree to radians c# 
Csharp :: c# char to int 
Csharp :: c# loop datatable rows 
Csharp :: unity color set alpha 
Csharp :: Csharp cast string to double 
Csharp :: c# length 2d array 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =