select *from xyxxb
where subject in (select subject,score from xxcjb where subject='语文' and subject>'60')
报错:服务器: 消息 116,级别 16,状态 1,行 1
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。我的xxcjb
1
孙艳肖 0131 计算机 93.200000000000003 优 1
孙艳肖 0131 数学 93.200000000000003 优 1
孙艳肖 0131 数学 93.200000000000003 优 1
薛艺肖 0021 数学 98.0 优 1
孙艳茹 0322 语文 89.0 良 1
孙艳稳 0623 数学 75.0 良 1
孙艳肖 0131 语文 63.0 及格 1
孙兴胜 8920 历史 56.0 差 1
梁浪涛 0901 英语 99.0 优 1
梁美娜 0131 英语 66.0 及格 1
吉武伟 0131 历史 89.0 优 1
吉武宁 0131 数学 86.0 优 1
陈莎 0131 语文 78.0 良 1
陈世豪 0131 历史 68.0 及格
where subject in (select subject,score from xxcjb where subject='语文' and subject>'60')
报错:服务器: 消息 116,级别 16,状态 1,行 1
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。我的xxcjb
1
孙艳肖 0131 计算机 93.200000000000003 优 1
孙艳肖 0131 数学 93.200000000000003 优 1
孙艳肖 0131 数学 93.200000000000003 优 1
薛艺肖 0021 数学 98.0 优 1
孙艳茹 0322 语文 89.0 良 1
孙艳稳 0623 数学 75.0 良 1
孙艳肖 0131 语文 63.0 及格 1
孙兴胜 8920 历史 56.0 差 1
梁浪涛 0901 英语 99.0 优 1
梁美娜 0131 英语 66.0 及格 1
吉武伟 0131 历史 89.0 优 1
吉武宁 0131 数学 86.0 优 1
陈莎 0131 语文 78.0 良 1
陈世豪 0131 历史 68.0 及格
where subject in (select subject from xxcjb where subject='语文' and subject>'60')
where subject in (select subject from xxcjb where subject='语文' and subject>'60')
是大于60的所有科目吗
select *from xyxxb
where subject in (select subject from xxcjb where score>'60')select * from xxcjb where subject='语文' and score>'60'
where subject in (select subject,score from xxcjb where subject='语文' and subject>'60')
select *from xyxxb
where subject in (select subject from xxcjb where subject='语文' and subject>'60')
*
from
xyxxb
where
subject in (select subject from xxcjb where subject='语文' and subject>'60')或者
select
*
from
xyxxb t
where
exists (select subject from xxcjb where subject='语文' and subject>'60' and subject=t.subject)
不如直接?
select * from xxcjb where subject='语文' and subject>'60'
where subject in (select subject,score from xxcjb where subject='语文' and subject>'60')
报错:服务器: 消息 116,级别 16,状态 1,行 1
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。
--报错是因为用嵌套查询时没有指定唯一列名;
where subject in (select subject,score
|--------------------|------|
指定唯一
where subject in (select subject
|--------------------|或者用exists:
select * from xyxxb as a
where exists in (select subject,score from xxcjb where a. subject = subject and subject='语文' and subject>'60') 比如