locked
formula to sum specific value RRS feed

  • Question

  • User-1075092149 posted

    i would like to ask can i extract the data where the field_1 col. is "A" or "B" or "C"  and then sum up field_2 value in the formula ???

    that mean the datasource as below:

    Field_1     Field_2

    A             1

    B             2

    C             3

    D             4

     

    here is the result: (1+2+3)

    output : 6

    how to do in the formula ??

    Tuesday, August 30, 2011 4:12 AM

All replies

  • User1682618242 posted

    select sum(Field_2) from TableName where Field_1 in ('A', 'B', 'C')

    Tuesday, August 30, 2011 4:47 AM
  • User-1075092149 posted

    select sum(Field_2) from TableName where Field_1 in ('A', 'B', 'C')

     

    BUT IN THE FORMULA I CAN'T SELECT TABLE NAME, I CAN ONLY SELECT THE FIEDL THAT I HAVE IMPORTED FROM THE DATASOURCE, AND I HAVE TRIED THAT I CAN'T WRITE THIS SQL IN THE FORMLA EXPRESSION FIELD.

     

    HOW CAN I CREATE A CUSTOM FIELD IN CRYSTAL REPORT? SO THAT I CAN DRAG THE FIELD AND PLACE ON THE REPORT.

    Tuesday, August 30, 2011 11:37 AM