Jupiter rules
Jupiter rules

Reputation: 61

I have weird Column Name duplicate problem in My Sql Left Join

CREATE VIEW `trainingdetail` AS 
select `training_detail`.`id` as `id`
  ,`training`.`id` AS `training_id`
  ,`training`.`startdate` AS `startdate`
  ,`training`.`enddate` AS `enddate`
  ,concat(`training_detail`.`fname`,' ',`training_detail`.`lname`) AS `fullname` 
from `training_detail`  
 left join `training`  on ((`training`.`id`=`training_detail`.`training_id_p`))
where `training_detail`.`id` is NOT NULL 

I can create this view no issue. but when i try to convert to ORM objects i get this in propel

 Column "id" declared twice in table "trainingdetail"

Both Training_detail and Training table has id column

===========================================================

who can solve it?

Upvotes: 0

Views: 131

Answers (1)

In the following line:

left join training on ((training.id=training_detail.training_id_p))

what does it mean "training_detail.training_id_p".

In the table of training_detail the name of the column is id

you mentioned it: select training_detail.id as id

so here you changed the name of the column.

why?

use the same name.

Upvotes: 1

Related Questions