Author Topic: boolean distinct match search  (Read 727 times)

0 Members and 1 Guest are viewing this topic.

Offline isedeasyTopic starter

  • Enthusiast
  • Posts: 248
    • View Profile
boolean distinct match search
« on: March 02, 2010, 03:46:14 PM »
My sql query fails to work :(

I am new to this BOOLEAN MODE search...

Code: [Select]
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...

Code: [Select]
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
I <3 Memcache

Offline isedeasyTopic starter

  • Enthusiast
  • Posts: 248
    • View Profile
Re: boolean distinct match search
« Reply #1 on: March 02, 2010, 05:36:00 PM »
Sorry the code is

Code: [Select]
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 <3 Memcache

Offline isedeasyTopic starter

  • Enthusiast
  • Posts: 248
    • View Profile
Re: boolean distinct match search
« Reply #2 on: March 02, 2010, 08:48:24 PM »
I worked out what i was doing wrong

Code: [Select]
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
I <3 Memcache