it would be better to perform sql join query before showing it on html or java if you are getting the data from two different table or query