EVOLUTION-MANAGER
Edit File: fulltext_two_inner_join.test
# Copyright(C) 2012 Kouhei Sutou <kou@clear-code.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --source include/have_innodb.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings DROP TABLE IF EXISTS users, posts, comments; --enable_warnings SET NAMES utf8; CREATE TABLE users ( id int NOT NULL, name varchar(50) NOT NULL, PRIMARY KEY (id), KEY (name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE posts ( id int NOT NULL, content mediumtext, user_id int NOT NULL, PRIMARY KEY (id), FULLTEXT KEY (content) ) DEFAULT CHARSET=utf8; CREATE TABLE comments ( id int NOT NULL, user_id int NOT NULL, post_id int NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO users VALUES (1, "Alice"), (2, "Bob"), (3, "Calros"); INSERT INTO posts VALUES (1, "Hello!", 1), (2, "World!", 2), (3, "Great!", 3); INSERT INTO comments VALUES (1, 1, 1), (2, 2, 1), (3, 3, 3); SELECT * FROM comments INNER JOIN posts ON posts.id = comments.post_id AND MATCH (posts.content) AGAINST ("Hello!" IN BOOLEAN MODE) INNER JOIN users ON users.id = comments.user_id AND users.name = "Alice"; DROP TABLE users, posts, comments; --source ../../include/mroonga/have_mroonga_deinit.inc