带有连接的MySQL查询只返回一个结果

时间:2017-03-28 05:19:09

标签: mysql

SELECT
  f.Codigo_interno AS f_internal_code,
  f.Nombre AS f_name,
  p.Codigo_practica AS p_internal_code,
  p.Nombre AS p_name,
  p.Nomenclador_nacional AS p_external_code,
  fpl.Codigo_plan AS fpl_internal_code,
  fpl.Plan AS fpl_name,
  fp.code AS fp_code,
  fp.description AS fp_description,
  fp.enabled AS fp_enabled
FROM financier_practice_disabled_in_plan fpd
  INNER JOIN obra_social f on fpd.financier_id = f.Codigo_interno
  INNER JOIN practicas p on fpd.practice_id = p.Codigo_practica
  INNER JOIN obra_social_plan fpl on fpl.Codigo_plan = fpd.plan_id
  INNER JOIN financier_practice fp on fp.practice_id = p.Codigo_practica AND fp.financier_id = f.Codigo_interno
WHERE fpd.financier_id = 10

输出:

10  OSDE    11.11.02    Práctica 1  11.11.02    111 210 10.10.02    Descripción 1   0

但是financier_practice_disabled_in_plan表中有两条记录:

practice_id financier_id plan_id
11.11.02      10            111
11.11.03      10            112

我做错了什么?

0 个答案:

没有答案