1
SELECT * FROM POST WHERE ID IN 
    (SELECT ID, MATCH(TITLE, CONTENT) AGAINST ('something lalala') AS score 
    FROM POST_SHADOW WHERE MATCH(TITLE, CONTENT) AGAINST ('something lalala') 
    ORDER BY score DESC)

so subquery give me 2 column (ID and score) what causes problem. I dont know how remove score's column with not removing order of showing record.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
user3740840
  • 15
  • 1
  • 4

1 Answers1

0

I guess you need to show the post according to the score of post_shadow table whose id column is associated with post id you can rewrite your query using join as below

SELECT 
  p.* 
FROM
  POST 
  JOIN POST_SHADOW ps 
    ON (p.ID = ps.ID) 
WHERE MATCH(ps.TITLE, ps.CONTENT) AGAINST ('something lalala') 
ORDER BY MATCH(ps.TITLE, ps.CONTENT) AGAINST ('something lalala') DESC

You can use the whole expression in order by clause to order your results accordingly if there is one-to-many relation b/w post and post_shadow then change your select part to SELECT DISTINCT p.* ...

M Khalid Junaid
  • 63,861
  • 10
  • 90
  • 118