Thanks - so what i have something like this:
PHP Code:
SELECT photos.url, photos.caption FROM photos JOIN friends ON friend1 = '$userid' && friend2 = photos.userid
UNION
SELECT photos.url, photos.caption FROM photos JOIN friends ON friend1 = photos.userid && friend2 = '$userid'
My actual query is quite a bit more substantial with a number of different joins (this one being the only problematic one) so would i just repeat the entire query after UNION?
ie.
PHP Code:
SELECT something, else
JOIN ...
JOIN ...
JOIN friends ON friend1 = '$userid' && friend2 = photos.userid
WHERE...
UNION
SELECT something, else
JOIN ...
JOIN ...
JOIN friends ON friend1 = '$userid' && friend2 = photos.userid
WHERE...
And yes i have defined friend1 and friend2 as unique...
Bookmarks