This topic is locked
[SOLVED]

 Use Field For Search But Not For List

7/5/2013 12:54:14 PM
ASPRunnerPro General questions
T
Tim author

I have a table with the following fields:
TransactionDate ,Item, Sales, Units
I would like the list page to show this:
select item, sum(sales) as Sales, sum(units) as Units

from ItemSales

group by item
But I'd like to use the TransactionDate field for the search criteria. If I add the TransactionDate field to this query (in the query tab of the ASPR wizard) so that it is available as a search field, I have to add it to the group by clause, which then makes the list page return one row per item, per day. But I want the search results to sum sales and units for the date (or date range); so I would get one row per item, regardless of the day sold. Is this possible?
Thanks,

Tim

Sergey Kornilov admin 7/5/2013

I'm not 100% sure but you can try something like this:

select item, min(TransactionDate), sum(sales) as Sales, sum(units) as Units

from ItemSales

group by item