Hola Gente, tengo la siguiente consulta:
trivias_Users
Código:
+-----------+-------------+-----------+---------------+---------------+
| user_FBid | user_NickFB | trivia_id | user_fullname | user_details |
+-----------+-------------+-----------+---------------+---------------+
| 7878 | pepegomez | 01 | jose gomez | bla bla bla |
| 7878 | pepegomez | 02 | jose gomez | ye ye ye |
+-----------+-------------+-----------+---------------+---------------+
trivias_UserAnswers
Código:
+-----------+-----------+---------------+------------------+--+
| user_FBid | trivia_id | answer_values | answer_reception | |
+-----------+-----------+---------------+------------------+--+
| 7878 | 01 | A,B,C | date 1 | |
| 7878 | 02 | B,B,B | date 2 | |
+-----------+-----------+---------------+------------------+--+
Quiero traer los datos del usuario de un user_FBid que coincida con la trivia 01en ambas tablas, pero si traigo los datos de la trivia 01 en trivias_Users me trae los datos de la trivia 02 en trivias_UserAnswers y viceversa
Código SQL:
Ver originalSELECT
trivias_Users.user_FBid,
trivias_Users.user_nickFB,
trivias_Users.user_fullname,
trivias_UserAnswers.trivia_ID,
trivias_UserAnswers.user_FBid,
trivias_UserAnswers.answer_values,
trivias_UserAnswers.answer_reception
FROM trivias_Users
INNER JOIN trivias_UserAnswers
ON trivias_Users.user_FBid = trivias_UserAnswers.user_FBid
WHERE trivias_UserAnswers.trivia_ID =02
GROUP BY trivias_Users.user_FBid
ORDER BY trivias_UserAnswers.answer_reception
[/php]
Es posible que la condición WHERE traiga dos columnas?
Código SQL:
Ver originalWHERE trivias_UserAnswers.trivia_ID = 02 AND trivias_User.trivia_ID = 02
[/html]