访问2010编写SQL语句

时间:2013-04-22 03:47:35

标签: ms-access ms-access-2010

我正在Access 2010中为我的作业编写SQL语句。我要做的是Display the Client Number, Client Name, Bookkeeper Number, First Name, and Last Name for all clients. Sort the records in ascending order by bookkeeper number and client number。这就是问我的问题。但是当我写这个语句时,我收到一个错误,说簿记员号码可以引用from子句中的多个表。我怎么能绕过这个?

这是我到目前为止所尝试的

select C.[client number], C.[client name], C.[bookkeeper number], B.[firstname]
from [client] C, [bookkeeper] B
order by [bookkeeper number], [client number] ASC;

1 个答案:

答案 0 :(得分:2)

要解决此错误,只需在B.中添加order by,如下所示:B.[bookkeeper number]

但是要获得正确的结果,您还必须在两个表之间添加INNER JOIN子句。