Let us say that I have two columns in my database one is for CourseName, and the other is for StudentsName. The CourseName column has repeated values. I want the results of a query to be displayed (grouped) something like, A Heading with Course Name and Student Name. Under the course name, I need only the CourseName to be printed once (which means the rowspan would be equal to the number of Students) The Student Name column would have all the students printed out for the particular course. This should go in a loop for each Course Name. How to do this formatting in HTML? I am using mySQL / JSP.