Output from the database of categories and photos

Hello! Joomla has a photo gallery component DatsoGallery. So, I’m trying to display categories of photos from the database from the database in such a way that all categories are displayed, and one photo is displayed for each. How can I do that? There are two tables, one for all categories, the other for photos.


Answer 1, authority 100%

Select a category and a photo, grouping by category, the result will be one photo per category.