Friends,
I need a view by using the below four separate queries. is it possible with these different kind of where condition?
from hostel database i will be getting hostel fees and from the three colleges database i will be getting the tuition fees of their respective colleges.
i need it like below
rollnumber, firstname, initial, hostelfees, tuitionfees, yearcourse,college
use hostel
select sc.RollNumber,s.FirstName,s.Initial,sc.Balance as 'HostelFees','' as
TuitionFees,b.YearCourse,s.College
from Student_Closing sc,Student s,batchcourse b
where
s.RollNumber =sc.RollNumber
and
b.BatchCode =s.Batch
and
sc.Balance > 5000
and
b.FeeActive ='Y'
order by s.College,sc.RollNumber
use college1
select sc.RollNumber,s.FirstName,s.Initial ,'' as HostelFees,sc.Balance as
'TutionFees',b.YearCourse,'college1' as College
from Student_Closing sc,Student s,batchcourse b,Applicant a
where
s.RollNumber =sc.RollNumber
and
b.BatchCode =s.Batch
and
b.FeeActive ='Y'
and
s.ApplNo =a.ApplNumber
and
a.Community not in ('S','T','A','P')
and
((sc.Balance > 0 and a.GraduateType not in ('F'))
or
(a.GraduateType='F' and sc.Balance > 20000))
and
s.FeeActive ='Y'
and
s.RollNumber not like '15%'
order by
sc.RollNumber
use college2
select sc.RollNumber,s.FirstName,s.Initial ,'' as HostelFees,sc.Balance as
'TuitionFees',b.YearCourse,'college2' as College
from Student_Closing sc,Student s,batchcourse b
where
s.RollNumber =sc.RollNumber
and
b.BatchCode =s.Batch
and
b.FeeActive ='Y'
and
sc.Balance > 0
order by
sc.RollNumber
use college3
select sc.RollNumber,s.FirstName,s.Initial ,'' as HostelFees,sc.Balance as
'TutionFees',b.YearCourse,'college3' as College
from Student_Closing sc,Student s,batchcourse b,Applicant a
where
s.RollNumber =sc.RollNumber
and
b.BatchCode =s.Batch
and
b.FeeActive ='Y'
and
s.ApplNo =a.ApplNumber
and
a.Community not in ('S','T','A','P')
and
((sc.Balance > 0 and a.GraduateType not in ('F'))
or
(a.GraduateType='F' and sc.Balance > 20000))
and
s.FeeActive ='Y'
and
s.RollNumber not like '15%'
order by
sc.RollNumber
thanks