일부 사용자의 데이터를 표시하는 쿼리를 수행하려면 먼저 다른 쿼리를 사용해야하며 설명하기가 어렵습니다. 나는 내가 따르는 사용자의 데이터를 얻고 싶지 않다. 내가 따르지 않는 데이터를보고 싶다. 그래서 내가 "follow_follower", "사용자"두 개의 테이블이 지금은 중간 쿼리를 할 수 있지만 일치하지 않습니다잠시 동안 쿼리 하위 쿼리
follow_follower
cod seguidor seguido
1 1 2
2 1 3
3 1 8
4 1 6
5 8 2
6 2 8
7 2 4
8 3 2
9 5 1
User
cod nombre apellido telefono
1 carlos cardenas 12587
2 Umberto Contreras 125488
3 carlos Torres 44587
4 Victor Sambrano 69754
5 Carlos Barragan 3698741
6 Jorge Cantor
7 Umberto Zanetty 578825
8 Miguel Cantor 5488787
확인하고 당신이 볼 경우 사용자가 1이라고 follow_follower 네 개의 필드는 (카를로스 카르데나스)
select distinct(nombre), apellido, telefono
FROM usuario
where cod<> ANY(select seguido from follow_follower where seguidor=1)
order by cod
그러나 모든 쿼리의 DISTINC 없음 행 : 먼저 나를 따라 선택 후 사람들의 모든 데이터가 개의 다른 모든 사용자를 얻을 수 쿼리를 어떻게 "DISTICN는"내 쿼리를 참조하십시오. , 나는 MySQL의 쿼리 ADVANCE의 작은 알고 :(다른 문제는 내 DB를에 쓰기된다는 점이다
내가 나를 따르지 않는 사람들의 목록 조금 원하는 좋아하지만 난 당신의 쿼리 및 표시 오류가 표시 스페인어 ...하지만처럼 테이블 dB 시도로 이동합니다! 그래서
SELECT distinct(usua.cod), usua.nick, desi.usuario, main.dir, main.size, main.x, main.y, main.R, main.G, main.B, main.A
FROM usuario AS usua, design AS desi, mainPhoto AS main
WHERE desi.usuario = usua.cod
AND desi.cod = main.design
AND usua.cod <> ANY(select seguido from seguidor_seguido where seguidor=1)/**!!!!!/
AND main.dir <> ''
AND main.type =1
ORDER BY usua.nick DESC
LIMIT 44 , 6
진정한 가져 오기 (사용자의 콘텐츠 데이터) 사용자 선호도이라는 독특한 테이블 :
이것은 진정한 쿼리입니다 및 seguidor_seguido (모든 기록이 따르는 내용)
012 3,516,--- 테이블 seguidor_seguido 설명 : 요청이 다르지만 원래이 같은 문제에서
seguidor_seguido
cod // is the id of the record
seguidor // is the user that follow to other users
seguido // is the user that is followed by other users
을! 감사합니다 : D