I am trying to create a view but get the following error:
View’s SELECT contains a subquery in the FROM clause
I am running the following command. I can’t seem to figure out how to substitute the nested selects with joins. Any help would be much appreciated!
create view student_fee_basic as select fsbc.*, ffp.name, ffp.amount 'fee' from (select sbc.*, ffc.name 'fname', ffc.id 'fid' from (select s.admission_no, s.first_name, bc.id 'bid', bc.code, bc.name from (select b.id, b.name, c.code from batches b, courses c where b.name = '2014-2015' and b.course_id = c.id) bc left join students s on bc.id = s.batch_id) sbc left join finance_fee_categories ffc on ffc.batch_id = sbc.bid where ffc.name = 'Basic Monthly') fsbc left join finance_fee_particulars ffp on ffp.finance_fee_category_id = fsbc.fid;