Does anyone sees any error in this?
I tried everything, google it and still getting the same results, even when i replace the $uid with the number of the id still the same.
I have two columns friend_one and friend_two and i want to show results where neither column has the $uidSELECT * FROM users U, friends F WHERE NOT (F.friend_two = '$uid' OR F.friend_one = '$uid') GROUP BY U.uid ORDER BY U.uid DESC
SimonIoa
77
Master Poster
Recommended Answers
Jump to PostHow about this?
SELECT * FROM users U, friends F WHERE '$uid' NOT IN(F.friend_two, F.friend_one) GROUP BY U.uid ORDER BY U.uid DESC
Jump to PostSorry, the only thing I can see is what diafol suggested. Perhaps using a JOIN??
Jump to PostTo get correct result
1) I think you need to join clause to join users U, friends F
2) need to put where f.friend_two <> '$uid' and F.friend_one <> '$uid'
Jump to Posttry following as i suggested before
where f.friend_two <> '$uid' and F.friend_one <> '$uid'
Jump to PostI guess problem is in your join
LEFT JOIN friends F ON U.uid=F.friend_one
You already joing uid with freind one , with that query you willl never receive result.
can you post both sample table script and sample data here or at
All 18 Replies
diafol
SimonIoa
77
Master Poster
Dani
4,074
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
urtrivedi
276
Nearly a Posting Virtuoso
SimonIoa
77
Master Poster
SimonIoa
77
Master Poster
urtrivedi
276
Nearly a Posting Virtuoso
SimonIoa
77
Master Poster
urtrivedi
276
Nearly a Posting Virtuoso
SimonIoa
77
Master Poster
SimonIoa
77
Master Poster
SimonIoa
77
Master Poster
SimonIoa
77
Master Poster
SimonIoa
77
Master Poster
urtrivedi
276
Nearly a Posting Virtuoso
SimonIoa
77
Master Poster
urtrivedi
276
Nearly a Posting Virtuoso
SimonIoa
77
Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.