摘要: SELECT group_concat( DISTINCT concat_ws( '', concat_ws( '|', ip_id, is_primary, A.note, B.ip ) ) ) FROM common_device_intranet_ip_relation AS A LEFT J 阅读全文
posted @ 2021-03-09 14:43 $Elvin 阅读(114) 评论(0) 推荐(0)
摘要: SELECT C.ipsegment,D.ipsegment_scan_num FROM ddos_network_ipstatus AS A INNER JOIN common_idc_ip AS B ON A.ip_id = B.id INNER JOIN common_idc_ipsegmen 阅读全文
posted @ 2021-03-09 14:41 $Elvin 阅读(377) 评论(0) 推荐(0)
摘要: 列子:查找A.follow_up_plan 为5是否存在 SELECT * FROM base_potential_client_info AS A LEFT JOIN base_sys_user AS B ON A.account_manager_id = B.id WHERE locate('5 阅读全文
posted @ 2021-03-09 14:40 $Elvin 阅读(64) 评论(0) 推荐(0)
摘要: 1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。 2.应尽量避免在 where 子句中使用!=或<>操作符,否则将引擎放弃使用索引而进行全表扫描。 3.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引 阅读全文
posted @ 2021-03-09 14:38 $Elvin 阅读(89) 评论(0) 推荐(0)
摘要: -- 查看索引 show index from server_networkport_relation; show index from server_ipmi_relation; show index from server_hardware_config; show index from dev 阅读全文
posted @ 2021-03-09 14:37 $Elvin 阅读(95) 评论(0) 推荐(0)
摘要: SELECT * FROM A WHERE IFNULL(B1,'') != 1 测试代码 过滤 type不等于door_open_log_sync,janitor-synchron-status,janitor-synchron,janitor-users-sync SELECT * FROM b 阅读全文
posted @ 2021-03-09 14:35 $Elvin 阅读(88) 评论(0) 推荐(0)
摘要: 批量插入数据: Yii::$app->db->createCommand()->batchInsert('ac_users', ['email', 'password', 'first_name'], [ ['james.franklin@example.com', 'changeme7', 'Ja 阅读全文
posted @ 2021-03-09 14:31 $Elvin 阅读(715) 评论(0) 推荐(0)