0

How to compare records from one column with 'match against'? That code is not working properly:

$sql = 'SELECT * FROM `database` WHERE MATCH (`content` WHERE `id` != \'\')AGAINST (`content` WHERE `id` = \'\' IN BOOLEAN MODE)'; 
$p = $db->query($sql);
Donidon
  • 11
  • 7
kkapuscik2
  • 136
  • 6
  • Perhaps you can edit your question to explain what are you are trying to achieve. Your current query makes no sense. – timclutton Jul 21 '14 at 12:28

2 Answers2

0

I'm not sure of what you're asking for. Someone else has provided a pretty good response to a similar question posted in the following link:

Mysql search for string and number using MATCH() AGAINST()

Again it seems to me that you are trying to match patterns/expressions between 2 columns from 2 different tables, if I have understood your example correctly. If so, then maybe the solution provided in the link isn't 'the way to go'. It's up to you, hope it helps..

Community
  • 1
  • 1
0

As documented, the MATCH() syntax is like this:

MATCH (col1,col2,...) AGAINST (expr [search_modifier])

And is described as:

MATCH() takes a comma-separated list that names the columns to be searched. AGAINST takes a string to search for, and an optional modifier that indicates what type of search to perform. The search string must be a string value that is constant during query evaluation. This rules out, for example, a table column because that can differ for each row.

So, the syntax you have used is completely invalid.

timclutton
  • 12,682
  • 3
  • 33
  • 43