我有两张桌子
表A
imei_no | user_name | date_of_allocation | date_of_deallocation
123 | a | 1-4-2013 | 10-4-2013
456 | a | 10-4-2013 | 25-4-2013
789 | a | 25-4-2013 | 30-4-2013
123 | b | 25-4-2013 | 27-4-2013
表 B
imei | lat | long | gpsdate
123 | 23 | 43 | 2-4-2013
123 | 23 | 43 | 2-4-2013
456 | 23 | 43 | 3-4-2013
123 | 23 | 43 | 3-4-2013
789 | 23 | 43 | 24-4-2013
123 | 23 | 43 | 24-4-2013
456 | 23 | 43 | 28-4-2013
123 | 23 | 43 | 28-4-2013
我希望特定用户的 imei 从日期 5-4-2013 到 25-4-2013 我这样做:
select imei from A where user_name='a' and date_of_allocation>='5-4-2013' and date_of_deallocation<='25-4-2013';
我想从表 B 中获取该用户的数据。我该怎么做。
select Imei of user a from some date to some date,then data of that imei for that user from table B