在带有联接的三个表中选择query

本文关键字:三个 query 选择 | 更新日期: 2023-09-27 18:24:43

access 2010中有三个表(room_info、student_info、commodity_info)

1-房间信息

room_id - autonumber - primary key
room_no - number
floor_no - text 
part_type - text
year_reserved - text

2-学生信息

student_id - autonumber - primary key
student_name - text
college - text
dept - text
stage - text
card_id - number
mobile_No - number
room_id - number - foreign key

3-商品信息

commodity_id - autonumber - primary key
chair - number
desk - number ..............
room_id - number - foreign key

我想做一个选择查询,从c#中的这三个表中选择数据?

在带有联接的三个表中选择query

MS-ACCESS中的INNER JOIN

我不会向你提供完整的C# code,因为这就像用勺子喂。

select *
from ((room_info
inner join student_info on room_info.room_id =student_info.room_id)
inner join commodity_info on room_info.room_id =commodity_info.room_id)