ERROR (undefined_column): column l1.info_id does not exist

I am using ecto joins , already defined the schema has_many, another model has belongs_to, so this is the association. when i use join in the function, Then show this error, I dont need id field in the case, How to fix it.

Why you would not need info_id field? You need it in order to connect records across tables.

Looks to me like you need to generate and run a migration that will add info_id column to the model you defined blongs_to in.

I know that, But there has two tables, Actually, They are same field is info_number , not info_id, also needn’t foreign key, I dont want this two tables have relate in postgresql databases, and it can use join to fetch data in my code.

In that case I think you can remove has_many and belongs_to from the code. Cause by using this two you need to config it somehow to relate one field or (sometime composite fields) as a foreign_key to another table.
If you will use join explicitly in your query then you don’t need any has_many and belongs_to, but by doing this you will lose the referential integrity between entities.