SELECT distinct nick from AdmUser AS A inner join AdmUserDating as AD on A.uID = AD.uID inner join ( ( SELECT uID from GeoCnt AS GC where GC.cntCheck not in ('pending', 'confirmed') ) union ( SELECT uID FROM Xp AS X where X.xpCheck not in ('pending', 'confirmed') and visibility != 'none' ) ) as T on T.uID = A.uID where A.gID >= 5 AND AD.city = 301079 - Lost connection to MySQL server during query