Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am new to QS . I have 2 tables with same key of a and want to get the count of fields. Do I need to do a join or any other way? Thanks.
table1:
Load * Inline [
a,b
1,2,
2,2
3,3,
4,2
];
table 2:
Load * Inline [
a,d
1,yy1
1,yy2
2,dd3
2,dd4
3, xx1
4, zz1
];
Want to get result of count so i can display on screen the count of b like this.
a, count of b
1, 2
2, 3
3, 1
4, 1
@mimivan Please see the below script.
NoConcatenate
table1:
Load * Inline [
a,b
1,2
2,2
3,3
4,2
];
left join (table1)
Load * Inline [
a,d
1,yy1
1,yy2
2,dd3
2,dd4
3, xx1
4, zz1
];
Main:
Load a,
Count(b)
Resident table1
Group by a;
Drop table table1;
Exit Script
If this resolves your issue, please like and accept it as a solution.
@mimivan Please see the below script.
NoConcatenate
table1:
Load * Inline [
a,b
1,2
2,2
3,3
4,2
];
left join (table1)
Load * Inline [
a,d
1,yy1
1,yy2
2,dd3
2,dd4
3, xx1
4, zz1
];
Main:
Load a,
Count(b)
Resident table1
Group by a;
Drop table table1;
Exit Script
If this resolves your issue, please like and accept it as a solution.
HI
Based on ur scenario, both A & B occur in the same table. So no need to join the tables.
And also, can u explain how Count of b is "3" in the expected results?
Thanks for pointing out my typo in the sample. Want to get result of count of d not b, so i can display:
a, count of d
1, 2
2, 2
3, 1
4, 1