speedman_2001
Registered User.
- Local time
- Today, 07:41
- Joined
- May 23, 2008
- Messages
- 30
Tried to come up with the best title that would fit the solution I'm trying to find and I apologize if it does not appropriately fit. DB is MSSQL 2005. What I have is a table that holds my unit location assignment and the date it was assigned there. As the unit is re-assigned locations a row is added to "move" it to the new location. Example is
UnitID LocationID EffectiveDate
123 A 2007-12-27 00:00:00.000
123 B 2008-02-28 00:00:00.000
123 A 2008-03-17 00:00:00.000
123 B 2008-04-03 00:00:00.000
I have a report that I'm trying to put together that needs to check and see if Unit 123 is at location B anytime between 2 dates, example - 2008-02-24 through 2008-03-01. The way the data above reads is that the unit is assigned to Location A 12/27/07, then assigned to location B as of 2/28/08. I know by looking at the data that the unit was part of location B sometime between the two dates, I'm just having a problem coming up with a query to tell me that. I'm not worried about the # of days the unit was there, just need to know if it was at location B anytime during that time frame.
Hope this gives everyone enough information and isn't too confusing as to what I'm looking for.
Joe
UnitID LocationID EffectiveDate
123 A 2007-12-27 00:00:00.000
123 B 2008-02-28 00:00:00.000
123 A 2008-03-17 00:00:00.000
123 B 2008-04-03 00:00:00.000
I have a report that I'm trying to put together that needs to check and see if Unit 123 is at location B anytime between 2 dates, example - 2008-02-24 through 2008-03-01. The way the data above reads is that the unit is assigned to Location A 12/27/07, then assigned to location B as of 2/28/08. I know by looking at the data that the unit was part of location B sometime between the two dates, I'm just having a problem coming up with a query to tell me that. I'm not worried about the # of days the unit was there, just need to know if it was at location B anytime during that time frame.
Hope this gives everyone enough information and isn't too confusing as to what I'm looking for.
Joe