求高手帮菜鸟写一SQL语句,急~ 有学生表student(stu_id,stu_name),借阅表book(stu_id,b_name),查询从来借过一本书的学生列表。就是这个...... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from student where stuid in (select stu_id from book where b_name = 'yourbookname') --从来未借过一本书?select *from studentwhere not exists(select 1 from book where stu_id=studenet.stu_id) 是从来没借过打的吧!select * from studentwhere not exist (select distinct stu_id where student.stu_id = book.stu_id) SELECT * FROM student WHERE stuid IN(SELECT stuid FROM book GROUP BY stuid HAVING COUNT(b_name)=1) select *from student where stu_id in (select stu_id from book group by stu_id having count(b_name)=1) select * from student where stu_id not in(select distinct stu_id from book) 求:服装生产-库存处理 sql选择排行第三的值. 求一条取重复记录的SQL语句 如何自动给表中的数据顺序分配行号? Sql Server 2005安装问题...急! 求庫存的SQL語句 如何保留前面得0啊? 谁知道哪里有ERwin下载么?(急需) 求一个SQL查询语句 ado访问mssql,无法获取存储参数的问题. 帮忙找找代码哪里运行不对了? 一个并发查询的问题
(select stu_id from book where b_name = 'yourbookname')
*
from
student
where
not exists(select 1 from book where stu_id=studenet.stu_id)
select * from student
where not exist (select distinct stu_id where student.stu_id = book.stu_id)
(SELECT stuid FROM book GROUP BY stuid HAVING COUNT(b_name)=1)
select *from student where stu_id in (select stu_id from book group by stu_id having count(b_name)=1)