So the result is one record id = 1

SELECT exam.Exm_Id FROM exam LEFT JOIN health_plan_config ON Hpc_Exm_Id = Exm_Id GROUP By exam.Exm_Id 

That's the mistake

 SELECT exam.Exm_Id, health_plan_config.Hpc_Id FROM exam LEFT JOIN health_plan_config ON Hpc_Exm_Id = Exm_Id GROUP By exam.Exm_Id 

(1055) 42000: "Expression # 2 of the list" is not in the group column. Cirrus.health_plan_config.Hpc_Id; this is incompatible with sql_mode = only_full_group_by "

So it gives out not what you want

 SELECT exam.Exm_Id, health_plan_config.Hpc_Id FROM exam LEFT JOIN health_plan_config ON Hpc_Exm_Id = Exm_Id GROUP By exam.Exm_Id, health_plan_config.Hpc_Id 

result

 1 - 1 1 - 2 1 - 3 

I would like to get 1 - 1 well, or 1 - 3

Decision

 SELECT exam.Exm_Id, MAX(health_plan_config.Hpc_Id) FROM exam LEFT JOIN health_plan_config ON Hpc_Exm_Id = Exm_Id GROUP By exam.Exm_Id 
  • You kind of answered the question yourself, set max if you need the maximum value, or min, if the minimum is Mike
  • Well, yes, until I asked it reached =) - Serge Esmanovich
  • four
    maybe it is worth publishing the solution with the answer - Bald

0