From a table i have to display supplierryotnumber,receiverryotnumber, surityryotnumber1,surityryotnumber2 with their names. All their names are in a signle master table i.e. Ryotmaster i have written the following query
Code:
select a.supplieryotnumber,b.ryotname,a.recieverryotnumber,c.ryotname,a.surityryotnumber1,
d.ryotname, a.surirtyryotnumber2, e.ryotname from cmsplotmaster a, cmsryotmaster b,
cmsryotmaster c, cmsryotmaster d, cmsryotmaster e where a.supplierryotnumber = b.ryotnumber and
a.recieverryotnumber = c.ryotnumber and a.surityryotnumber1 = d.ryotnumber and
a.surityryotnumber2 = e.ryotnumber
it will display ryots details who are having guarantors(i.e. Surity1 and surity2) but i have to display all the ryots details irrespective of whether they have guarantors or not. If guarators are there i have to display their details. To use union we should have same number of columns. But if a ryot do not have surityryotnumbers then no of columns will be different.
Can anybody suggest how to write a query without using procedure to solve this problem?