zoukankan      html  css  js  c++  java
  • mysql之instr函数

    1.用于模糊查询,做为过滤条件

    ---------------------------上级的新闻下级可以看到-------------------------
    SELECT a.pk_cms_nrgl_st AS pk_id, a.time_stamp AS time_stamp, b.xalljgmc AS xalljgmc, a.cbt AS cbt, a.fk_cms_lmgl AS fk_cms_lmgl, a.cfbsj AS cfbsj, a.czt AS czt, a.cbody AS cbody, a.sys_xzqh AS sys_xzqh, a.sys_djzt AS sys_djzt, a.sys_djztms AS sys_djztms, a.sys_spzt AS sys_spzt, a.sys_spzt AS sys_spztmc, a.sys_spztms AS sys_spztms, a.sys_shrid AS sys_shrid, a.sys_shr AS sys_shr, a.sys_shrq AS sys_shrq, a.sys_xgrid AS sys_xgrid, a.sys_xgr AS sys_xgr, a.sys_xgrq AS sys_xgrq, a.sys_zdrid AS sys_zdrid, a.sys_zdr AS sys_zdr, a.sys_zdrq AS sys_zdrq FROM cms_nrgl_st a, mz_xzjg b WHERE a.sys_xzqh=b.xzqh_id AND a.sys_scbj = '0' AND INSTR('330101', b.node_id) > 0 AND a.sys_spzt = 1 ORDER BY time_stamp desc, cfbsj desc limit 0, 20

    配置

    <where name="user.xnode"  code="b.node_id"  datatype="string" attribute="true" scope="session" opersign="instrcode" link="AND" />

    2.以下代码等同上面的,用了concat做拼接

    SELECT a.pk_cms_nrgl_st AS pk_id, a.time_stamp AS time_stamp, b.xalljgmc AS xalljgmc, a.cbt AS cbt, a.fk_cms_lmgl AS fk_cms_lmgl, a.cfbsj AS cfbsj, a.czt AS czt, a.cbody AS cbody, a.sys_xzqh AS sys_xzqh, a.sys_djzt AS sys_djzt, a.sys_djztms AS sys_djztms, a.sys_spzt AS sys_spzt, a.sys_spzt AS sys_spztmc, a.sys_spztms AS sys_spztms, a.sys_shrid AS sys_shrid, a.sys_shr AS sys_shr, a.sys_shrq AS sys_shrq, a.sys_xgrid AS sys_xgrid, a.sys_xgr AS sys_xgr, a.sys_xgrq AS sys_xgrq, a.sys_zdrid AS sys_zdrid, a.sys_zdr AS sys_zdr, a.sys_zdrq AS sys_zdrq FROM cms_nrgl_st a, mz_xzjg b WHERE a.sys_xzqh=b.xzqh_id AND a.sys_scbj = '0' and a.sys_spzt = 1
    AND '33' LIKE concat(b.node_id,'%') ORDER BY time_stamp desc, cfbsj desc limit 0, 20

  • 相关阅读:
    MegaCli 简易使用介绍
    【转】RAID 技术发展综述
    HOWTO For iSCSI-SCST && Gentoo HOWTO For iSCSI-SCST
    FC磁盘设备管理
    targetcli配置iSCSI
    NVMe协议1.3c(一) 概述
    NVMe概述
    Jenkins slave image
    ansible module
    Ansible Filter
  • 原文地址:https://www.cnblogs.com/tongcc/p/11357293.html
Copyright © 2011-2022 走看看