Jump to content

boolean distinct match search


isedeasy

Recommended Posts

My sql query fails to work :(

 

I am new to this BOOLEAN MODE search...

 

SELECT DISTINCT MATCH(title, description) AGAINST ('search string' IN BOOLEAN MODE) d.id, d.title, d.description, m.image FROM deals d JOIN merchants m ON m.id = d.merchant WHERE d.status=1 AND MATCH(d.title, d.description) AGAINST ('search string' IN BOOLEAN MODE) ORDER BY d.added DESC LIMIT 0,24

 

here is the error I get...

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id, d.title, d.description, m.image FROM deals d JOIN merchants m ON m.id = d.merchant WHERE d' at line 1

 

If I remove the "d." from "d.id" the query runs but it grabs the id from merchants table. Bad naming on my part but I hope I can solve it without having to change the column name.

 

I am probably overlooking something really simple, cheers for any help

Link to comment
https://forums.phpfreaks.com/topic/193934-boolean-distinct-match-search/
Share on other sites

Sorry the code is

 

SELECT 
DISTINCT MATCH(title, description) 
AGAINST ('search string' IN BOOLEAN MODE) 
AS d.id, d.title, d.description, m.image 
FROM deals d 
JOIN merchants m 
ON m.id = d.merchant 
WHERE d.status=1 
AND MATCH(d.title, d.description) 
AGAINST ('search string' IN BOOLEAN MODE) 
ORDER BY d.added DESC 
LIMIT 0,24

 

the as got lost somehow

I worked out what i was doing wrong

 

SELECT 
DISTINCT MATCH(title, description) 
AGAINST ('search string' IN BOOLEAN MODE) 
AS relevance,
d.id, d.title, d.description, m.image 
FROM deals d 
JOIN merchants m 
ON m.id = d.merchant 
WHERE d.status=1 
AND MATCH(d.title, d.description) 
AGAINST ('search string' IN BOOLEAN MODE) 
ORDER BY relevance DESC 
LIMIT 0,24

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.