SELECT * FROM t1,t2,t3 WHERE t1.img_id=t2.img_id AND
t2.caption_id=t3.caption_id

Adolfo

> -----Original Message-----
> From: mike [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, December 19, 2002 8:15 PM
> To: [EMAIL PROTECTED]
> Subject: Help w/ Join Query
> 
> 
> Hello,
> 
> I working on a small my project to learn more about joins. I 
> have three 
> tables here is what they look like
> 
> CREATE TABLE `album` (
>   `album_id` smallint(3) NOT NULL auto_increment,
>   `name` text NOT NULL,
>   `description` text NOT NULL,
>   `img_id` smallint(5) NOT NULL default '0',
>   PRIMARY KEY  (`photo_album_id`)
> ) TYPE=MyISAM;
> 
> CREATE TABLE `images` (
>   `img_id` smallint(3) unsigned NOT NULL auto_increment,
>   `img_path` varchar(60) default NULL,
>   `img_caption_id` smallint(5) NOT NULL default '0',
>   PRIMARY KEY  (`img_id`)
> ) TYPE=MyISAM;
> 
> CREATE TABLE `img_caption` (
>   `caption` text NOT NULL,
>   `img_caption_id` smallint(5) NOT NULL auto_increment,
>   PRIMARY KEY  (`img_caption_id`)
> ) TYPE=MyISAM;
> 
> Is it possible write a join query that would join the album table and 
> the images table and then join the images table with the img_caption 
> table?. I would like to select name and description from album , 
> img_path from images, and caption from img_caption for any paticluar 
> album row.
> 
> Thanks in advance for the help,
> Mike
> 
> 
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to