What is the best way to build a MySQL query so as to:
- Display only 100% match if it exists (one row will be returned) or, if there isn't a 100% match,
- Display other entries with different accuracies (many rows returned, but not entries with 0% accuracy).
The results should resemble something like that:
SELECT Green Mile FROM books
Results:
Green Mile | 100%
SELECT Green Road FROM books
Results:
Green Mile | 50%
Winding Road | 50%
Greet Me | 20%
I am not providing any database schema as I will be grateful to receive general advice about how I could achieve similar results quering a database. I should add that queries and output are constructed in PHP.
Thank you in advance!