【发布时间】:2013-06-21 04:15:54
【问题描述】:
这是问题所在...我有这些表:
crs
title|semester
c++ |a
java |b
sql |a
crsstu
regnum|title
11131 |java
11131 |c++
11132 |java
11132 |sql
11133 |c++
11133 |sql
我想做的是从 crsstu 和表格中选择一个注册号(regnum),我想看看他还没有注册哪些课程。 示例:如果我选择 regnum 11131 那么它必须返回 sql,或者使用 11132 它返回 c++。
我已经走到这一步了:
select a.title
from crs as a,crsstu as b
where b.registrationnumber != 11133
and a.title != (select title
from crsstu
where registrationnumber = 11133)
但它显示了一个 1242 错误(子查询返回超过 1 行)。我知道我已经接近答案,但我不知道该怎么做。任何答案都会有帮助。谢谢你提前
【问题讨论】:
标签: mysql sql sql-server select where