请教一个连接查询
select * from tableA
+----+----------------+---------+
| id | v_code | inAmount|
+----+----------------+---------+
| 1 | 140906020005 | 100.00 |
+----+----------------+---------+
select * from tableB
+----+----------------+-------+-------------+
| id | v_code | price | v_status |
+----+----------------+-------+-------------+
| 1 | 140906020005 | 100 | 10 |
| 2 | 140906020005 | 200 | -30 |
+----+----------------+-------+-------------+
用连接查询
select f.* from
tableA as f inner join tableB as s on f.v_code=s.v_code
where
and f.inAmount> 0
and s.v_status in (10,-30)
查询出来的是2条记录,重复了一条,如何能过滤掉重复的记录
------解决方案--------------------说明下你的查询目的
先可以这样
select distinct f.* from
tableA as f inner join tableB as s on f.v_code=s.v_code
where
and f.inAmount> 0
and s.v_status in (10,-30)