Code:
SELECT pdetails_photos.photo_name
, pdetails_photos.photo_show
, pdetails_photos.photo_description
, pdetails_photos.photo_filename
FROM pdetails_category
INNER
JOIN pdetails_photos
ON pdetails_photos.photo_category = pdetails_category.category_id
WHERE pdetails_category.category_name =
( SELECT MIN(category_name)
FROM pdetails_category )
ORDER
BY pdetails_photos.photo_name ASC
by the way, unless you are expecting over 4 billion photos or categories, you should really use something smaller than BIGINT
also, declaring a KEY for a column that is already defined as a PRIMARY KEY is redundant and inefficient
Bookmarks