SELECT 2 ROWS FROM JOIN [closed]











up vote
-4
down vote

favorite












everyone.
I have the following query:



SELECT * FROM actor_mov 
INNER JOIN actor on actor_mov.aid = actor.aid
INNER JOIN movie on actor_mov.mid = movie.mid
WHERE actor.aname LIKE '%alvin%' OR
movie.name LIKE '%alvin%'


I would like to search for actor name and movie name at the same time. But its only possible the search movie names. How should I improve my query.



the goal is: serach for titanic or for Leonardo di caprio and both times get the movie data from titanic



Image to data



The Problem here is also that I get 4 Results instead of 1.



My Tables are Actor, Movie and actor movie as connection table










share|improve this question















closed as unclear what you're asking by Strawberry, Madhur Bhaiya, Hovercraft Full Of Eels, tripleee, Progman Nov 18 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 3




    Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Please go through this link once: Why should I provide an MCVE for what seems to me to be a very simple SQL query?
    – Madhur Bhaiya
    Nov 18 at 12:15















up vote
-4
down vote

favorite












everyone.
I have the following query:



SELECT * FROM actor_mov 
INNER JOIN actor on actor_mov.aid = actor.aid
INNER JOIN movie on actor_mov.mid = movie.mid
WHERE actor.aname LIKE '%alvin%' OR
movie.name LIKE '%alvin%'


I would like to search for actor name and movie name at the same time. But its only possible the search movie names. How should I improve my query.



the goal is: serach for titanic or for Leonardo di caprio and both times get the movie data from titanic



Image to data



The Problem here is also that I get 4 Results instead of 1.



My Tables are Actor, Movie and actor movie as connection table










share|improve this question















closed as unclear what you're asking by Strawberry, Madhur Bhaiya, Hovercraft Full Of Eels, tripleee, Progman Nov 18 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 3




    Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Please go through this link once: Why should I provide an MCVE for what seems to me to be a very simple SQL query?
    – Madhur Bhaiya
    Nov 18 at 12:15













up vote
-4
down vote

favorite









up vote
-4
down vote

favorite











everyone.
I have the following query:



SELECT * FROM actor_mov 
INNER JOIN actor on actor_mov.aid = actor.aid
INNER JOIN movie on actor_mov.mid = movie.mid
WHERE actor.aname LIKE '%alvin%' OR
movie.name LIKE '%alvin%'


I would like to search for actor name and movie name at the same time. But its only possible the search movie names. How should I improve my query.



the goal is: serach for titanic or for Leonardo di caprio and both times get the movie data from titanic



Image to data



The Problem here is also that I get 4 Results instead of 1.



My Tables are Actor, Movie and actor movie as connection table










share|improve this question















everyone.
I have the following query:



SELECT * FROM actor_mov 
INNER JOIN actor on actor_mov.aid = actor.aid
INNER JOIN movie on actor_mov.mid = movie.mid
WHERE actor.aname LIKE '%alvin%' OR
movie.name LIKE '%alvin%'


I would like to search for actor name and movie name at the same time. But its only possible the search movie names. How should I improve my query.



the goal is: serach for titanic or for Leonardo di caprio and both times get the movie data from titanic



Image to data



The Problem here is also that I get 4 Results instead of 1.



My Tables are Actor, Movie and actor movie as connection table







php mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 12:23

























asked Nov 18 at 12:12









YBC INC

11




11




closed as unclear what you're asking by Strawberry, Madhur Bhaiya, Hovercraft Full Of Eels, tripleee, Progman Nov 18 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Strawberry, Madhur Bhaiya, Hovercraft Full Of Eels, tripleee, Progman Nov 18 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 3




    Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Please go through this link once: Why should I provide an MCVE for what seems to me to be a very simple SQL query?
    – Madhur Bhaiya
    Nov 18 at 12:15














  • 3




    Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Please go through this link once: Why should I provide an MCVE for what seems to me to be a very simple SQL query?
    – Madhur Bhaiya
    Nov 18 at 12:15








3




3




Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Please go through this link once: Why should I provide an MCVE for what seems to me to be a very simple SQL query?
– Madhur Bhaiya
Nov 18 at 12:15




Welcome to Stack Overflow! Please provide a relevant and minimal sample data showcasing your requirements, and expected output. Please go through this link once: Why should I provide an MCVE for what seems to me to be a very simple SQL query?
– Madhur Bhaiya
Nov 18 at 12:15

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]