I have 2 table MainBranch and Subbranch
get the details from both the tables based on branch code
and branchname
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
@Entity()
export class MainBranch {
@Column()
branchcode: string
@Column()
branchName: string
@Column()
branchContact: string
@OneToOne(() => SubBranch, SubData => SubBranch.branchcode)
SubData:SubBranch
}
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
@Entity()
export class SubBranch {
@Column()
branchcode: string
@Column()
subName: string
@Column()
subContact: string
@OneToOne(() => MainBranch , MainBrnachData => MainBranch.branchcode)
MainBrnachData :MainBranch
}
I tried the below querys for that. But it throws an error “Query failed unknown column “
const details = this.mainBranchRepository.find(
relation:{
SubData:true,
},
where:{branchcode,branchname}
)
console.log(details )