内置函数和分组在Microsoft Access

时间:2015-05-20 15:25:44

标签: mysql sql ms-access join ms-office

我试图在Microsoft Access中使用内部联接从三个表中进行选择。在其中一个字段中,我还需要选择它返回的记录数。

SELECT Person.FirstName, Person.LastName, Person.Phone, 
Person.Email,Person.Address, Room.RoomNo, Room.Type, Building.Name, 
Floor.Name,count(*) as result

FROM (Floor INNER JOIN (Building INNER JOIN 
Room ON Building.BuildingID = Room.BuildingID) ON Floor.FloorNo = 
Room.FloorNo) INNER JOIN (Person INNER JOIN Patient ON Person.Username = 
Patient.Username) ON Room.RoomNo = Patient.RoomNo

WHERE (((Person.FirstName) Like "*" & [Forms]![search]![firstnameKey] & "*")
AND ((Person.LastName) Like "*" & [Forms]![search]![lastnameKey] & "*")) AND 
(patient.status = 1)

GROUP BY Patient.username  ;

1 个答案:

答案 0 :(得分:1)

只要您拥有汇总功能,您就必须puts Rails::Server.new.options[:Port] 未计算的字段。只需查看您的select语句,您就会返回多个字段,即:group by等。我相信您必须Person.Firstname, Person.Lastname这些非聚合字段。

示例代码:

group by