SQL query for fragments?
497542Mar 15 2006 — edited Mar 15 2006I've got another problem. I have a table called student. I've got 3 lease tables called lease1, lease2 and lease3. all of them are like this Lease (leaseno, s_date, e_date, roomno, studno). The student table is(studno, sname, dob, address).i also have a number of room tables called room1 and room2 and room3. Room (roomno, floor). Each room has its own leases therefore room1's leases are called lease1 and so on.
How do I put a query that will check that a student has not made a lease in room2 or room3 if he comes to get a lease in room1. A student cannot make more than 1 lease.
When I type as below, it says invalid sql query and missing expression
select studno, sname from student where student.sno not in
(select studno from lease1) and (select studno from lease2) and (select studno from lease3) order by studno
please help