android - Sqlite order by the many correct where statement -


how can order sqlite query clause.

for example:

 -------------------------------------- | id |      body                     | -------------------------------------- | 1  |the boy going bed        | -------------------------------------- | 2  |the boy child          | -------------------------------------- | 3  |the boy playing computer| 

and search input is:

"the boy going bed" 

so sql query be.

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

i want the id 1 first because have many correct clause.

in sqlite, result of boolean expression 0 or 1, can add these comparison expressions:

select * data body '%the%'    or body '%boy%'    or body '%is%'    or body '%going%'    or body '%to%'    or body '%bed%' order (body '%the%'  ) +          (body '%boy%'  ) +          (body '%is%'   ) +          (body '%going%') +          (body '%to%'   ) +          (body '%bed%'  )  desc; 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

qt - Passing a QObject to an Script function with QJSEngine? -

c# - Web API response xml language -