dimanche 16 août 2015

Sqlite order by the many correct where statement

How can i order by the sqlite query by its where clause.

for example:

data

| id | body |

| 1 |the boy is going to bed |

| 2 |the boy is good child |

| 3 |the boy is playing the computer|

and my search input is. search="the boy is going to bed"

so my sql query will be.

select * from data where body like '%the%' or like '%boy%' or like '%is%' or like '%going%' or like '%to%' or like '%bed%'

i want that the the id 1 is the first because its have a many correct where clause.

Aucun commentaire:

Enregistrer un commentaire