dianemarie
Instructor
Hello, my report is grouped by list id, and I show the list name in the group header. The data is from one ordhist table. We have a list lookup table but I can't use it because we have some data from old systems where the list information is in the ordhist table only. The list name changes over time, although the list id stays the same. Example:
OrderDate ListID ListName
4/1/10 123 CompanyCo Inc.
4/1/09 123 Company ABC, Inc.
4/1/08 123 Company ABC, Inc.
I have tried Min, Max, First, and sorting descending by order date on the group details to get the most recent list name to show in the header. Nothing worked consistently. I'm trying to do a sub query to create a new field called ListGroupHeaderName (or whatever) to use for the group header. Having trouble.... I want the results to look like this:
OrderDate ListId ListName ListGroupHeaderName
4/1/10 123 CompanyCo Inc. CompanyCo Inc.
4/1/09 123 Company ABC, Inc. CompanyCo Inc.
4/1/08 123 Company ABC, Inc. CompanyCo Inc.
I'm grouping by list ID in the report by the way, not the SQL query. The query just pulls the detail records by a parameter called @CustomerID. Any help would be appreciated. Thank you.
OrderDate ListID ListName
4/1/10 123 CompanyCo Inc.
4/1/09 123 Company ABC, Inc.
4/1/08 123 Company ABC, Inc.
I have tried Min, Max, First, and sorting descending by order date on the group details to get the most recent list name to show in the header. Nothing worked consistently. I'm trying to do a sub query to create a new field called ListGroupHeaderName (or whatever) to use for the group header. Having trouble.... I want the results to look like this:
OrderDate ListId ListName ListGroupHeaderName
4/1/10 123 CompanyCo Inc. CompanyCo Inc.
4/1/09 123 Company ABC, Inc. CompanyCo Inc.
4/1/08 123 Company ABC, Inc. CompanyCo Inc.
I'm grouping by list ID in the report by the way, not the SQL query. The query just pulls the detail records by a parameter called @CustomerID. Any help would be appreciated. Thank you.