【问题标题】:Access Database Using two tables使用两个表访问数据库
【发布时间】:2013-11-28 16:11:59
【问题描述】:

我有两个表,它们有一个公共字段 Class 和 Class Offered。我正在尝试创建一个查询,该查询将显示第一个表中的记录列表,其中第二个表中的记录在第二个列表中具有相同的类名。这可能吗。我的表格字段是:

表 1

Class, First_Name, Last_Name.

表 2

Class Offered, First_Name, Last_Name.

我希望显示查询/报告:

List One                 List Two
Table One                Table Two (where the class name is the same)

【问题讨论】:

  • 你试过joins????

标签: mysql sql


【解决方案1】:
select table1.* from table1 inner join table2 on table1.class = table2.classoffered

select * from table1 where exists (select 1 from table2 where table1.class= table2.classoffered)

【讨论】:

  • 这仅显示一个表中的数据,但无论如何感谢。萨拉
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多