I have 2 tables with a one-to-many relationship and want to fetch data with single query.
Table structure: Employee
- PK : #Emp-PK
- SK : #Emp-SK
- Name : "Test"
Table structure : Employee-projects
- PK: #Emp-PRO-PK
- SK: #Emp-PRO-SK
- EmpPKKey: #Emp-PK
- EmpSKKey: #Emp-SK
- project-title: "abc"
How do I get data in a manner like
Items {
PK : #Emp-PK
SK : #Emp-SK,
name : "Test",
projects : [{
PK : #Emp-PRO-PK
SK : #Emp-PRO-SK,
project-title : "abc"
},{
PK : #Emp-PRO-PK
SK : #Emp-PRO-SK,
project-title : "def"
},{
PK : #Emp-PRO-PK
SK : #Emp-PRO-SK,
project-title : "ghi"
}]
}
But I am expecting this in a single query or method. Is it possible?