Ok, so i want to populate a gridview with a rather complex statement that i have no idea how to get, I dont even know if its possible. five tables and a view are involved, these arent all the fields in the tables but just to make things clearer, i only put the required fields.Student Table:-\[code\]Student_IDSpecialization_ID\[/code\]Specialization Table:-\[code\]IDSpecialization_NameDepartment_ID\[/code\]Staff Table:-\[code\]IDStaff_ID Department_ID\[/code\]Department Table:-\[code\]IDDepartment_Name\[/code\]Survey Table:- (\[code\]Username\[/code\] is the uploader)\[code\]IDUsername\[/code\]Users View:- (Here the \[code\]Username\[/code\], \[code\]Password\[/code\] is taken from both the student table and the staff table)\[code\]UsernamePasswordUserType\[/code\]This is how i created the view:-\[code\]CREATE View [Users] asSelect Student_ID as Username, Password,'STU' as UserType from StudentunionSelect Staff_ID, Password, 'STF' as UserType from Staff\[/code\]Now, considering that when a staff member signs in, his username is stored in session \[code\]Session["Username"]\[/code\], what i want to pull from the database, are all the surveys that are uploaded by users (only students) that have a specialization that belongs to the current user's department. considering that all relationships (foreign keys) are set, what is the sql query i should use? or the method at least.