3

我有 3 个表是我的 SQL 数据库:

First Table: Room: ID <pk>, Roomname
Second Table: RoomRelationsship: ID<pk>, Room_ID <fk>, Roomattributes_ID<fk>
Third Table: Roomattributes: ID<pk>, Attributename

我如何获得属于房间的房间属性。我需要一个 SQL 查询。

先感谢您

4

1 回答 1

3
SELECT Room.ID, Room.Roomname, Roomattributes.Attributename 
FROM Room 
INNER JOIN RoomRelationsship ON RoomRelationsship.Room_ID = Room.ID
INNER JOIN Roomattributes ON RoomRelationsship.Roomattributes_ID = Roomattributes.ID
于 2012-06-13T07:42:16.437 回答