sql logic

Discussion in 'iOS Programming' started by chhoda, Jul 11, 2013.

  1. chhoda macrumors 6502

    Oct 25, 2008
    hi all,

    i understand this may not be a direct ios question but it is related to.

    i am developing an application in ios sqlite where i ned to search a db with records ordered by o of words found in the search string.

    for example if the search string "x y" strings containing x y will appear first, then strings containing x and then y.

    the question is is there a straight sql query to do this ? or i need to write my own function ?

  2. xStep macrumors 68000

    Jan 28, 2003
    Less lost in L.A.
    Searching strings within strings can be costly.

    Check out LIKE.
  3. chhoda thread starter macrumors 6502

    Oct 25, 2008
    I thought somebody will come up with a query that works :) , is it possible with only sql or i need to write logic with obj c and sql ?
  4. lucasgladding, Jul 17, 2013
    Last edited: Jul 17, 2013

    lucasgladding macrumors 6502

    Feb 16, 2007
    Waterloo, Ontario
    I don't have much experience with it, but this is probably a good place to start reading:

    Full-text search in SQL differs between implementations (i.e. MySQL, SQLite, MSSQL, etc), so you should be looking for examples specific to the implementation you're using. I have very limited experience with search, hence the vague response. Sorry I couldn't be more help.

Share This Page