I just spent five ours figuring out this:
Code:
$usernames = mysql_query("SELECT lg.username, lg.id FROM login lg WHERE lg.deleted='0' AND lg.id !='" . $_SESSION['id'] . "' AND lg.id IN (SELECT au.user_id FROM authorization au WHERE au.area NOT IN (SELECT se.area FROM sections se WHERE se.area NOT IN (SELECT au.area FROM authorization au WHERE au.authorization_level='administrator' AND au.user_id='" . $_SESSION['id'] . "'))) AND lg.id NOT IN (SELECT an.user_id FROM authorization an WHERE an.area IN (SELECT st.area FROM sections st WHERE st.area NOT IN (SELECT az.area FROM authorization az WHERE az.authorization_level='administrator' AND az.user_id ='" . $_SESSION['id'] . "')))");
Was that ever a headache! Hardest mysql_query I've put together so far.
The point of this thread: None really. But I was really stoked when I got that to work, and I wanted to share this with someone, and no one in my office would have any idea of what the hell I was talking about! We have the 'fuck off' thread and the 'fuck on' thread, maybe this can be our 'fuck ya!' thread.