日期:2014-05-16  浏览次数:20753 次

asp两表联查重复的数据怎么删除
8 OYE111208144334 
9 OYE111208144334  
10 OYE111208144334  
怎么把下面的两行数据给删除了啊,请各位前辈指教。
用的是mysql

------解决方案--------------------
SQL code
mysql> select * from table1;
+------+------+----------+
| id   | oid  | userName |
+------+------+----------+
| 01   | oye1 | user1    |
| 02   | oye2 | user2    |
+------+------+----------+
2 rows in set (0.06 sec)

mysql> select * from table2;
+------+------+-------+
| id   | oid  | gname |
+------+------+-------+
| 01   | oye1 | aaa   |
| 02   | oye1 | bbb   |
| 03   | oye2 | ddd   |
| 04   | oye2 | ggg   |
+------+------+-------+
4 rows in set (0.00 sec)

mysql> select table1.oid,group_concat(gname SEPARATOR  ''),userName
    -> from table1 ,table2
    -> where table1.oid=table2.oid
    -> group by table1.oid;
+------+-----------------------------------+----------+
| oid  | group_concat(gname SEPARATOR  '') | userName |
+------+-----------------------------------+----------+
| oye1 | aaabbb                            | user1    |
| oye2 | dddggg                            | user2    |
+------+-----------------------------------+----------+
2 rows in set (0.01 sec)

mysql>