How can I change this query to only return rows that return more than 0 rows?
I need to combine these two queries. I need to return rows where the second query returns at least 1 row.
SELECT albumData.*
FROM albumData
WHERE userID='$id'
AND state='0'
ORDER BY date DESC
SELECT photos.photo
FROM albums, photos
WHERE albums.userID = '$id'
AND albums.photoID = photos.id
AND albums.albumID = $albumID
ORDER BY photos.id DESC LIMIT 6;
EDIT add useful information from comments:
Table albumData containers unique rows, for each user, for each photo
album they have set up, this is where I want to return the number of
rows from initially. However I want to compare the id in albumData to
albumID is albums table, if the number of rows with
albums.albumID=albumData.id is more than one, then return those rows.
next try .. if I understand the problem right