貌似版主没仔细看我的标题...:L 你的用法不对,->distinct($val)其中$val目前类型只是bool,为真值就在编译的时候加上关键字DISTINCT,字符串类型的$val对->distinct()无效 visvoy 发表于 2009-10-23 18:50 static/image/common/back.gif
屏蔽重复的列,单单这个用程序控制就要花费很多额外开销,而数据只要一个distinct就解决了
像模糊查询,查 ...
表a:
id name
1 name1
2 name2
3 name3
表b:
name other
name2 other1
name2 other2
请问:
$this->distinct()->from('a')->join('b', 'a.name=b.name')->get()->result_array();
获取的值:
idname other
2 name2other1
2 name2 other2
如果我只是想获取唯一的id是不是
$this->select('a.id')->distinct()->from('a')->join('b', 'a.name=b.name')->get()->result_array();
页:
1
[2]