I think you're not interested in the total rows of table Test, but a count of related records based on SDS_ID. For that you first need to join the two tables. You can then calculate a count using the combined table. Or you could calculate the counts in the UI with expressions in charts instead of in the script.
Here's a simple example for the script:
Load SDS_ID, a,b,c
join Load SDS_ID, e, f
Load SDS_ID, count(a)
group by SDS_ID;