1drop table if exists t1, t2; 2CREATE TABLE t1 ( 3id int(10) unsigned NOT NULL auto_increment, 4q varchar(255) default NULL, 5PRIMARY KEY (id) 6); 7INSERT INTO t1 VALUES (1,'aaaaaaaaa dsaass de'); 8INSERT INTO t1 VALUES (2,'ssde df s fsda sad er'); 9CREATE TABLE t2 ( 10id int(10) unsigned NOT NULL auto_increment, 11id2 int(10) unsigned default NULL, 12item varchar(255) default NULL, 13PRIMARY KEY (id), 14FULLTEXT KEY item(item) 15); 16INSERT INTO t2 VALUES (1,1,'sushi'); 17INSERT INTO t2 VALUES (2,1,'Bolo de Chocolate'); 18INSERT INTO t2 VALUES (3,1,'Feijoada'); 19INSERT INTO t2 VALUES (4,1,'Mousse de Chocolate'); 20INSERT INTO t2 VALUES (5,2,'um copo de Vodka'); 21INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); 22INSERT INTO t2 VALUES (7,1,'Bife'); 23INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); 24SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6) 25as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; 26q item id x 27aaaaaaaaa dsaass de sushi 1 1.923787 28aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000 29aaaaaaaaa dsaass de Feijoada 3 0.000000 30aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000 31ssde df s fsda sad er um copo de Vodka 5 0.000000 32ssde df s fsda sad er um chocolate Snickers 6 0.000000 33aaaaaaaaa dsaass de Bife 7 0.000000 34aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000 35SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) 36as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; 37q item id x 38aaaaaaaaa dsaass de sushi 1 1 39aaaaaaaaa dsaass de Bolo de Chocolate 2 0 40aaaaaaaaa dsaass de Feijoada 3 0 41aaaaaaaaa dsaass de Mousse de Chocolate 4 0 42ssde df s fsda sad er um copo de Vodka 5 0 43ssde df s fsda sad er um chocolate Snickers 6 0 44aaaaaaaaa dsaass de Bife 7 0 45aaaaaaaaa dsaass de Pizza de Salmao 8 0 46SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6) 47as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; 48q item id x 49aaaaaaaaa dsaass de sushi 1 1.923787 50aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000 51aaaaaaaaa dsaass de Feijoada 3 0.000000 52aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000 53ssde df s fsda sad er um copo de Vodka 5 0.000000 54ssde df s fsda sad er um chocolate Snickers 6 0.000000 55aaaaaaaaa dsaass de Bife 7 0.000000 56aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000 57SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) 58as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; 59q item id x 60aaaaaaaaa dsaass de sushi 1 1 61aaaaaaaaa dsaass de Bolo de Chocolate 2 0 62aaaaaaaaa dsaass de Feijoada 3 0 63aaaaaaaaa dsaass de Mousse de Chocolate 4 0 64ssde df s fsda sad er um copo de Vodka 5 0 65ssde df s fsda sad er um chocolate Snickers 6 0 66aaaaaaaaa dsaass de Bife 7 0 67aaaaaaaaa dsaass de Pizza de Salmao 8 0 68drop table t1, t2; 69