即使尝试编写此查询,我也无法理解..
如果我有一个名为“WaitTable”的表,如下所示:
Id StartTime EndTime ShopName Request WaitTime
-------------------------------------------------------------------------------------------------
1 2013-08-24 19:30 2013-08-24 19:45 ClothesShop1 1 10
2 2013-08-24 19:30 2013-08-24 19:45 ClothesShop1 2 15
3 2013-08-24 19:30 2013-08-24 19:45 ClothesShop1 3 3
4 2013-08-24 19:45 2013-08-24 20:00 ClothesShop1 1 12
5 2013-08-24 19:45 2013-08-24 20:00 ClothesShop1 2 17
我想获取所有最后的唯一请求,以获取他们最后记录的等待时间。
例如,我想返回:
Id StartTime EndTime ShopName Request WaitTime
-------------------------------------------------------------------------------------------------
3 2013-08-24 19:30 2013-08-24 19:45 ClothesShop1 3 3
4 2013-08-24 19:45 2013-08-24 20:00 ClothesShop1 1 12
5 2013-08-24 19:45 2013-08-24 20:00 ClothesShop1 2 17