记录重复PostgreSQL

问题描述

我有以下SQL查询,运行时出现的问题是它显示了一些重复的记录,如果可以帮助我,将不胜感激

SELECT a.codeps,b.deneps,a.codlocacion,c.denlocacion,concat(substring(a.fcontable,7,2),'-',substring(a.fcontable,5,1,4)) AS fcontable,a.codcuenta,d.dencuenta,d.inf,a.glosa,(a.movdeudor-a.movacreedor) AS movimiento,e.inicial
FROM moveps04 AS a
LEFT OUTER JOIN eps AS b ON a.codeps=b.codeps
LEFT OUTER JOIN localidad AS c ON a.codeps=c.codeps
AND a.codlocacion=c.codlocacion
LEFT OUTER JOIN plancuentas AS d ON trim(a.codcuenta)=trim(d.cuenta)
LEFT OUTER JOIN saldoseps AS e ON a.codeps=e.codeps
AND trim(a.codcuenta)=trim(e.codcuenta)
WHERE a.codeps=4
  AND a.codlocacion=2
  AND a.periodo<='201603'
  AND substring(trim(a.periodo),4)='2016'
  AND substring(trim(a.codcuenta),3)='339'
  AND e.anio='2016'
ORDER BY a.codeps,a.codcuenta

Image result

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)