MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Michael T. Babcock Date:November 1 2002 5:28pm
Subject:Re: Select statement
View as plain text  
John Chang wrote:

> In the output table I see:
> I Spy  Eddie Murphy
> I Spy Kelly Robinson
> I Spy Owen Wilson


This discussion has taken place in the last two weeks before; what 
you're missing is that it doesn't matter what your output looks like in 
mysql; you're supposed to format it in your program.  You've got the 
right query already, but if you want to get the data seperately and 
possibly more efficiently, do two queries (I'm making up the table 
names; I'm sure you can figure it out):

SELECT @MovieID:=ID, Name FROM Movies
-- Display Name. --
SELECT * FROM Actors LEFT JOIN MovieActors ON ActorsID = Actors.ID Where 
MovieID = @MovieID;
-- Loop through each result, displaying names --

-- 
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock


Thread
Select statementJohn Chang1 Nov
  • Re: Select statementMichael T. Babcock1 Nov
Re: Select statementJason Thiesse1 Nov