原生php结果集如何去重?
使用原生的php查询的结果集有重复的,去重的时候遇到了一些问题:
下面是$row数字中的数据:
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(84)
["drivername"]=>
string(9) "田明奇"
["drivetypetext"]=>
string(2) "B1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(84)
["drivername"]=>
string(9) "田明奇"
["drivetypetext"]=>
string(2) "B1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(752)
["drivername"]=>
string(6) "往来"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(755)
["drivername"]=>
string(6) "小小"
["drivetypetext"]=>
string(2) "C1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(759)
["drivername"]=>
string(12) "测试连续"
["drivetypetext"]=>
string(2) "A3"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(760)
["drivername"]=>
string(8) "测试16"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(761)
["drivername"]=>
string(8) "测试17"
["drivetypetext"]=>
string(2) "B2"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(765)
["drivername"]=>
string(2) "ls"
["drivetypetext"]=>
string(2) "A3"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(768)
["drivername"]=>
string(3) "hjx"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(774)
["drivername"]=>
string(4) "yycc"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(775)
["drivername"]=>
string(6) "测试"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(776)
["drivername"]=>
string(3) "123"
["drivetypetext"]=>
string(2) "B1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(777)
["drivername"]=>
string(6) "王某"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(777)
["drivername"]=>
string(6) "王某"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}array(5) {
["coid"]=>
int(281)
["drid"]=>
int(84)
["drivername"]=>
string(9) "田明奇"
["drivetypetext"]=>
string(2) "B1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(84)
["drivername"]=>
string(9) "田明奇"
["drivetypetext"]=>
string(2) "B1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(752)
["drivername"]=>
string(6) "往来"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(755)
["drivername"]=>
string(6) "小小"
["drivetypetext"]=>
string(2) "C1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(759)
["drivername"]=>
string(12) "测试连续"
["drivetypetext"]=>
string(2) "A3"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(760)
["drivername"]=>
string(8) "测试16"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(761)
["drivername"]=>
string(8) "测试17"
["drivetypetext"]=>
string(2) "B2"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(765)
["drivername"]=>
string(2) "ls"
["drivetypetext"]=>
string(2) "A3"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(768)
["drivername"]=>
string(3) "hjx"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(774)
["drivername"]=>
string(4) "yycc"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(775)
["drivername"]=>
string(6) "测试"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(776)
["drivername"]=>
string(3) "123"
["drivetypetext"]=>
string(2) "B1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(777)
["drivername"]=>
string(6) "王某"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
array(5) {
["coid"]=>
int(281)
["drid"]=>
int(777)
["drivername"]=>
string(6) "王某"
["drivetypetext"]=>
string(2) "A1"
["drivercompleteflag"]=>
int(0)
}
如何把重复的过滤掉呀?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在sql查询中进行处理就ok了,distinct使用的时候必须放在开头,放在后面会出现错误。
你是这个意思???
function arr_uniq($arr,$key)
{
}