1

I have multiple records in my table's column, most of them are duplicate entries. I want to sum them up so that what ever the number is duplicate should be summed up just once, like:

Numbers
10
10
10
15
20

The summed result should be 45 I am using this query:

/sum(summary.filter(start_time>='2013-01-01'&end_time<='2013-05-01'&student='john'&course='BCS').s_sub_n)

Please help me where I can put ^ to distinct s_sub_n

MHS
  • 2,260
  • 11
  • 31
  • 45

1 Answers1

2

ok, if I am not getting you wrong, you want the Number column to be distinct and then added.

Distinct Number Column(s_sub_n):
10
15
20

and then its sum = 45

so the htsql query would be:

sum(summary.filter(start_time>='2013-01-01'&end_time<='2013-05-01'&student='john'&course='BCS')^{s_sub_n}{s_sub_n})
Ali Raza Bhayani
  • 3,045
  • 26
  • 20