I have the following simplified table structure in the SQL 2000 Databse:
ID AppName Key Value EffectiveDate
-- ------- ----- ------- -------------
1 App1 One Past 1/1/1900
2 App1 One Present 1/1/2010
3 App1 One Future 1/1/9999
4 App1 Two Past 1/1/1900
5 App1 Two Present 1/1/2010
6 App1 Two Future 1/1/9999
7 App2 One Present 1/1/2010
8 App2 Two Present 1/1/2010
I need to ask a question:
Given a specific one AppName, show me all the ONLY LAST Key / Value pairs whoseEffectiveDate <= GetDate()
So, if I called my secret request with AppName = 'App1', then my results:
ID AppName Key Value EffectiveDate
-- ------- ----- ------- -------------
2 App1 One Present 1/1/2010
5 App1 Two Present 1/1/2010
EDIT:
The value can be any. (“Past,” “Present,” “Future”) were simply used to make this example clearer. They could very well be (45, "Bob", "% $ #% @ # $").
source
share