Hi
I am using LLBLGen 4.2, Self servicing.
I have a table with the following attributes:
Id (integer)
Code (int)
Description (varchar 60)
DateTimeBegin (date time)
DateTimeBegin is a date that can be in the past or future.
I want to list the combinations of the Code and Descriptions that are currently valid.
E.g. by filtering on MAX(DateTimeBegin) for a Code where DateTimeBegin <= DateTime.Now
And then I also want a lists of combinations that are not currently valid because they have a DatTimeBegin that lies in the past and is not in the first list.
I could try to solve this using a typed view, but are there other ways?
E.g.
select Id, DateTimeBegin, Code, Description from TCS_Recipe as T1 inner join (select Code as MaxCode, MAX(DateTimeBegin) as MaxDateTimeBegin from TCS_Recipe where DateTimeBegin > GetDate() group by Code) as T2 ON T1.Code = T2.MaxCode and T1.DateTimeBegin = T2.MaxDateTimeBegin