Hello,
I'm working on SQL Server 2005.
I have a table which basically looks like below.
It's a list which tracks the movement of assets from one location to another.
For example Asset1 was moved from location 10 to 20 in March 2011.
AssetNo|FromLocation|ToLocation|Year|Month
Asset1 | 10 | 20 |2011| 03
Asset2 | 10 | 30 |2011| 04
Asset1 | 20 | 30 |2011| 07
Asset2 | 30 | 20 |2011| 07
The result I'm after is to show me the asset location for the whole year for every month by AssetNo like shown below.
I know a little bit SQL but don't know whether that is possible at all?
AssetNo|Location|Year|Month
Asset1 | 10 |2011| 01
Asset1 | 10 |2011| 02
Asset1 | 20 |2011| 03
Asset1 | 20 |2011| 04
Asset1 | 20 |2011| 05
Asset1 | 20 |2011| 06
Asset1 | 30 |2011| 07
Asset1 | 30 |2011| 08
Asset1 | 30 |2011| 09
Asset1 | 30 |2011| 10
Asset2 | 10 |2011| 01
Asset2 | 10 |2011| 02
Asset2 | 10 |2011| 03
Asset2 | 30 |2011| 04
Asset2 | 30 |2011| 05
Asset2 | 30 |2011| 06
Asset2 | 20 |2011| 07
Asset2 | 20 |2011| 08
Asset2 | 20 |2011| 09
Asset2 | 20 |2011| 10
Any help much appreciated.
I'm working on SQL Server 2005.
I have a table which basically looks like below.
It's a list which tracks the movement of assets from one location to another.
For example Asset1 was moved from location 10 to 20 in March 2011.
AssetNo|FromLocation|ToLocation|Year|Month
Asset1 | 10 | 20 |2011| 03
Asset2 | 10 | 30 |2011| 04
Asset1 | 20 | 30 |2011| 07
Asset2 | 30 | 20 |2011| 07
The result I'm after is to show me the asset location for the whole year for every month by AssetNo like shown below.
I know a little bit SQL but don't know whether that is possible at all?
AssetNo|Location|Year|Month
Asset1 | 10 |2011| 01
Asset1 | 10 |2011| 02
Asset1 | 20 |2011| 03
Asset1 | 20 |2011| 04
Asset1 | 20 |2011| 05
Asset1 | 20 |2011| 06
Asset1 | 30 |2011| 07
Asset1 | 30 |2011| 08
Asset1 | 30 |2011| 09
Asset1 | 30 |2011| 10
Asset2 | 10 |2011| 01
Asset2 | 10 |2011| 02
Asset2 | 10 |2011| 03
Asset2 | 30 |2011| 04
Asset2 | 30 |2011| 05
Asset2 | 30 |2011| 06
Asset2 | 20 |2011| 07
Asset2 | 20 |2011| 08
Asset2 | 20 |2011| 09
Asset2 | 20 |2011| 10
Any help much appreciated.