Reputation: 145
I dont no what is the problem with the below query. It returns 12 rows instead of single row. Kindly suggest me whether below query is correct or not. If not, correct the problem in below query. Thanks in advance.
SELECT
M.name, MR. review, MAN.running_time, MC.screen_name, MI.producer,
MI.director,MI.story, MI.bgm_score,MI.screenplay, MI.music,
MS.story, MS.screenplay, MS.dialogue, MS.direction, MS.music, MS.bgm,
MS.cinematography, MS.characterization, MS.shotlocation, MS.editing,
MS.production, MS.performance, CC.certificate FROM tttbl_review_language RL
JOIN tttbl_censor_certificate CC
JOIN tttbl_movie M
INNER JOIN tttbl_movie_review MR ON MR.movie_id=M.id
INNER JOIN tttbl_movie_analytics MAN ON MAN.movie_id=M.id
INNER JOIN tttbl_movie_cast MC ON MC.movie_id=M.id
INNER JOIN tttbl_movie_info MI ON MI.censor_id=CC.id AND MI.movie_id=M.id
INNER JOIN tttbl_movie_score MS ON MS.movie_id=M.id
WHERE M.id=1
Upvotes: 0
Views: 123
Reputation: 133370
You have not on condition
between tttbl_review_language RL, tttbl_censor_certificate CC and tttbl_movie M
then these table could produce a cartesian product with other result ..
select
M.name,
MR. review,
MAN.running_time,
MC.screen_name,
MI.producer,
MI.director,
MI.story,
MI.bgm_score,
MI.screenplay,
MI.music,
MS.story,
MS.screenplay,
MS.dialogue,
MS.direction,
MS.music,
MS.bgm,
MS.cinematography,
MS.characterization,
MS.shotlocation,
MS.editing,
MS.production,
MS.performance,
CC.certificate
FROM tttbl_review_language RL
JOIN tttbl_censor_certificate CC
JOIN tttbl_movie M
INNER JOIN tttbl_movie_review MR ON MR.movie_id=M.id
INNER JOIN tttbl_movie_analytics MAN ON MAN.movie_id=M.id
INNER JOIN tttbl_movie_cast MC ON MC.movie_id=M.id
INNER JOIN tttbl_movie_info MI ON MI.censor_id=CC.id AND MI.movie_id=M.i
Upvotes: 2