我有两个表 ( IncomingDocs
) 和 ( OutgoingDocs
),每个表都有一个名为SubmitDate
(datatype Datetime
) 和DepositNo
(datatype Int
) 的字段,每个表都可以在一个表中 DeposotNo
有多个。Submitdate
For example;
_IncomingDocs table_
**DepositNo** | **SubmitDate**
1 | 10/3/2012 12:00:00 AM
1 | 12/3/2012 12:00:00 AM
2 | 10/3/2012 12:00:00 AM
3 | 10/3/2012 12:00:00 AM
3 | 13/3/2012 12:00:00 AM
4 | 20/3/2012 12:00:00 AM
_OutgoingDocs table_
**DepositNo** | **SubmitDate**
1 | 11/3/2012 12:00:00 AM
2 | 15/3/2012 12:00:00 AM
3 | 12/3/2012 12:00:00 AM
3 | 14/3/2012 12:00:00 AM
4 | 19/3/2012 12:00:00 AM
SELECT DepositNo, SubmitDate
FROM IncomingDocs AS i, OutgoingDocs as o
WHERE DepositNo = 1
ORDER BY SubmitDate
* The output of the query should be:
_Output table_
**DepositNo** | **SubmitDate**
1 | 10/3/2012 12:00:00 AM << From IncomingDocs table
1 | 11/3/2012 12:00:00 AM << From OutgoingDocs table
1 | 12/3/2012 12:00:00 AM << From IncomingDocs table
我希望输出是特定 DepositNo 的记录(在 WHERE 子句中指定)并按提交日期排序。