RE: [PHP] Multipe Tables, Single Query Problem
| From: | Simon Kimber | Date: | Tue, 19 Jun 2001 14:55:20 +0000 |
| Subject: | RE: [PHP] Multipe Tables, Single Query Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54376@lists.php.net to get a copy of this message | ||
Christopher Wrote...
> You need to be able to tie at least one field from each table to
> one other
> field in another table, and then you can have a query like:
>
> SELECT videos.*, links.*, actors.*
> FROM videos, links, actors
> WHERE videos.VideoID = '$VideoID' AND
> links.VideoID = videos.VideoID
> actors.ActorID = links.ActorID
>
Thanks Christopher,
but wouldn't this return a separate row for each actor? I'm pretty sure i
need something more than a simple join :o(
Here's my original question again: "what i need to do is return a particular
video and all it's staring actors with just one query returning just one
row, ie. with all the actor names in one field"
Ray Wrote...
> Something like:
>
> SELECT name, title, description from videos, actors, links where
> actors.ID = links.ID and videos.ID=videoID, and videos.ID = 20; ?
>
> But in just want one row? You could return all the names in one row (I
> think) using MySQL (I assume?) string functions... I have a funny
> feeling you need a sub select, which mysql doesnt support...
>
Ray, I have a funny feeling you could be right :o(
Cheers
Simon Kimber
Funny.co.uk - The Comedy Portal
http://www.funny.co.uk/
Now Incorporating: The UK Live Comedy Directory
FREE promotion for UK Comedy Acts and Venues
http://www.funny.co.uk/uklive/
eml. simon@funny.co.uk
icq. 16156911