一条SQL查询语句

来源:百度知道 编辑:UC知道 时间:2024/05/21 10:38:18
select * from Students where class=? and score=100
问号 处我想查的是所有班级,但最好不要把"class"去掉!有些方法还需要"class".
class的条件是所有班级!
例如,我查330510班级:select * from Students where class=330510 and score=100
用这个语句的时候有一个特殊情,我要查所有班级:select * from Students where class=? and score=100
问号我我应该怎么写?
或只能再重新写一个方法?

select * from students where class=class and score=100

如果要查所有班级就不需要限定Class的条件了
可以去掉
也可以写成class=*就可以了
用通配符*来表示

可能是这种吧
select * from IP where startIP=202.196.201.5
如果不对你再说详细呢。

要查班级就直接
select class from student where score=100

select * from Students where class in(Select class from Students ) and score=100