Multiple Child Records in single query (1 Viewer)

mfaisal.ce

Member
Local time
Today, 12:45
Joined
Dec 21, 2020
Messages
76
Dear Friends,

Kindly guide me,

1. T1 (ID,Name) --- Master Table
2. T2(ID,Qty) ----- Child Table

Now, my question is how i can make a query, which will sum(qty) from T2 against each record in T1....

Example ;

T1
IDName
1A1Pent
2A2Shirt
3A3Jeans


T2
IDQty
1A1100
2A250
3A370
4A150
5A245
6A3100
7A1100
8A280
9A390
 

mike60smart

Registered User.
Local time
Today, 10:45
Joined
Aug 6, 2017
Messages
1,904
You need to get the table structure correct

Can you upload a zipped copy of the database?
 

mike60smart

Registered User.
Local time
Today, 10:45
Joined
Aug 6, 2017
Messages
1,904
Dear Friends,

Kindly guide me,

1. T1 (ID,Name) --- Master Table
2. T2(ID,Qty) ----- Child Table

Now, my question is how i can make a query, which will sum(qty) from T2 against each record in T1....

Example ;

T1
IDName
1A1Pent
2A2Shirt
3A3Jeans


T2
IDQty
1A1100
2A250
3A370
4A150
5A245
6A3100
7A1100
8A280
9A390
Hi
See the attached example.
Study the relationships between table1 and table2

The query1 gives you the Total Quantities
 

Attachments

  • Test.zip
    20.3 KB · Views: 420

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:45
Joined
Feb 19, 2002
Messages
43,233
Select t1.ID, T1.[Name], Sum(T2.Qty) AS Total
From T1 Left Join T2 on T1.ID = T2.ID
Group by T1.ID, T1.[Name]

PS "Name" is the name of a property and so is a poor choice as a column name.
 

Users who are viewing this thread

Top Bottom