what db
--
Ryan


On Fri, May 29, 2009 at 9:41 AM, Chad Gray <cg...@careyweb.com> wrote:

>
> I have two tables that are joined one to many.
>
> I would like to write a query to get the one from the first table and only
> one from the many table.
>
> TABLE1
> AlbumID, AlbumTitle
> 1, MyPictures
>
> TABLE2
> PictureID, AlbumID, PictureName
> 1, 1, test.jpg
> 2, 1, test2.jpg
>
> How do I write the query to only get one record from TABLE2 when I join?
>
> SELECT *
> FROM TABLE1
> JOIN TABLE2 ON TABLE2.AlbumID = TABLE1.AlbumID
> WHERE TABLE1.AlbumID = 1
>
> This query returns 2 records because there are two matches in TABLE2.
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322966
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to