• In your query, you should be able to do something like the following:

    @ParmValue = passed in parm value

    Select

    ID

    ,sum(value) as ValueOut

    from

    Table

    group by

    ID

    having

    sum(value) <= @ParmValue