Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have this query that does not return any results:

SELECT
    MATCH (e.firstname, e.lastname, e.tc_identity) AGAINST ('Baha') AS Score
    , e.*
FROM
    employees AS e
WHERE
    MATCH (e.firstname, e.lastname, e.tc_identity) AGAINST ('Baha' IN BOOLEAN MODE)
ORDER BY `Score` DESC;

firstname, lastname and tc_identity are of type varchar.

I have data in firstname like 'Bahadir', 'Bahadır', etc...

When I try to match against 'Baha', I get no results.

When I try to match against 'Bahadir' or 'Bahadır', I get no results.

What's the problem?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Your query is looking for the token = 'Baha'. You need a wildcard search for 'Baha*'.

Please try the following

SELECT
MATCH (`e`.`firstname`, `e`.`lastname`, `e`.`tc_identity`) AGAINST ('Baha*') AS `Score`,
`e`.*

FROM
`employees` AS `e`

WHERE
MATCH (`e`.`firstname`, `e`.`lastname`, `e`.`tc_identity`) AGAINST ('Baha*' IN BOOLEAN MODE)

ORDER BY `Score` DESC
share|improve this answer
    
Results return, but score looks 0 ? –  Kronokrator Sep 20 '12 at 6:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.