最近在做Yii2的项目时, 发现了一个yii2 自带的Ar模型会自动对搜索出来的字段去重. 默认去重字段: id, 其他字段暂没发现 1. 例如: public function fields { //aboutClass表的ID id => about_class_id } 如果搜索关系是一对多的关系,那么搜索出来的about_class_id 有重复,这时你给about_class_id 命名为id,因为yii2对id字段默认去重,就会出现数据条数变少的情况 解决方案: public fu
大家好,我是小皓. 一.背景 今天在博主练习MYS创建表操作时遇到一个语法报错,就想着来和大家分享一下MYSQL如何在创建表时添加判断条件: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[if not exists] tb_name(