function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gaddam rajgaddam raj 

Create a visual force page like below requirement...

Hostel 1                                          Hostel   2                                           Hostel   3
Student 1                                      student  5                                          student 9
student  2                                     student  6                                           student  10
student  3                                      student 7                                           student  11
student  4                                       student 8                                            student  12
Grazitti TeamGrazitti Team

Hi,

Acording to your requirement, we think you have two custom objects, one for hostels and another for students. On students object there must be a lookup of hostel. Now you can create a controller in which you query for the hostels with their related students like:

public class hostelRelatedStudent{
    public List<Hostel> hostels{get;set;}
    public List<student> hostel1Students{get;set;}
    public hostelRelatedStudent(){
       hostels = [select id,name, (select id,name from students) from hostel];
       for(hostel h : hostels){
            if(h.name == 'hostel 1'){
                hostel1Students = h.students;
            }
       }
    }
}
Now create a vf page and show the results of the query accordingly.
 
Hostel 1
<apex:repeat value="{!hostel1Students}" var="s">
    {!s.name}
</apex:repeat>

Please mark it as best if this helps you.

Regards,
Grazitti Team
www.grazitti.com