R
R
roadtoexp2018-09-17 15:40:57
MySQL
roadtoexp, 2018-09-17 15:40:57

How to exclude incomplete repetitions of lines?

There is a table: 5b9fa1d86e0f2501736963.png
There is a query:

SELECT
  SIGN(COALESCE(location_id, 0)) + SIGN(COALESCE(division_id, 0)) + SIGN(COALESCE(position_id, 0)) as score, 
    keyword.*
FROM
  keyword
WHERE 
  (city_id = 5 OR city_id IS NULL) AND
    (location_id = 7 OR location_id IS NULL) AND
    division_id IS NULL AND
    position_id IS NULL AND
    MATCH (keyword) AGAINST ('еда банкомат') 
GROUP BY
  title
DESC
ORDER BY
  score
DESC
LIMIT 10

I get: 5b9fa1d221070375730603.png
And I want to get instead: ID 40, ID 48
Works correctly on MySQL 5.6.
MySQL Version 5.7.20

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question