博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年1月31日

摘要: 1、删除重复的值的行。SQL 删除列中的重复值D name13 张三1123 张三15 李四17 李四我要得到的结果是ID name13 张三15 李四答案:delete from 表where id not in(select min(id) from 表 group by name ) //删除重复名字的记录 阅读全文

posted @ 2012-01-31 15:59 bug yang 阅读(185) 评论(0) 推荐(0) 编辑

摘要: 假设我们要排序数组为:$data=array(array(1,2,3,4,5,6,7,8), array(1,2,3,4,5,6,7,8), array(1,2,3,4,5,6,7,8), array(1,2,3,4,5,6,7,8), array(1,2,3,4,5,6,7,8));我们要按照$data数组中的第一列的正序,和第二列的倒序进行排列。做法如下:foreach($data as $item){ $first[]=$item[0]; $second[]=$item[1];}array_multisort($first,SORT... 阅读全文

posted @ 2012-01-31 15:37 bug yang 阅读(213) 评论(0) 推荐(0) 编辑