simawenbo12
2019-10-15 16:49 阅读 450

Android SQLite sql语句问题

view_contacts JOIN (SELECT contact_id AS snippet_contact_id, ifnull((SELECT MIN(data1) FROM data JOIN raw_contacts ON (data.raw_contact_id = raw_contacts._id) JOIN phone_lookup ON data._id=phone_lookup.data_id WHERE search_index.contact_id=contact_id AND normalized_number LIKE 'XXX%'),content) AS snippet FROM search_index WHERE search_index MATCH 'content:*XXX* OR name:16* OR tokens:XXX*' AND snippet_contact_id IN default_directory) ON (_id=snippet_contact_id) LEFT OUTER JOIN agg_presence ON (_id = agg_presence.presence_contact_id) LEFT OUTER JOIN status_updates contacts_status_updates ON (status_update_id=contacts_status_updates.status_update_data_id)

以上是一个查询联系人的语句,XXX是输入的手机号码,只能匹配以XXX为开头的语句,现要修改为仅包含就可以匹配。

我把 LIKE XXX前面+了%号 , MATCH XXX前加了*号,不知道为什么还是没用。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

相关推荐