脚本宝典收集整理的这篇文章主要介绍了php – 如何在我的查询CODEIGNITER中使用DISTINCT,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$q = $this->db->select(' Books.tITle,reserved_books.id,reserved_books.isbn,reserved_books.PRice,reserved_books.item_sold,reserved_books.date_sold,reserved_books.total_amount ') ->From('reserved_books') ->join('books','reserved_books.isbn= books.isbn') ->limit($limit,$offset);
我怎么能在我的查询中使用distinct?
reserved_books.isbn是唯一的.
$this->db->distinct();
但是,区别并不总是有效.你应该添加 – > group_by(“name_of_the_column_which_needs_to_be unique”);
$this->db->group_by('column_name');
以上是脚本宝典为你收集整理的php – 如何在我的查询CODEIGNITER中使用DISTINCT全部内容,希望文章能够帮你解决php – 如何在我的查询CODEIGNITER中使用DISTINCT所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。