开发者

Retrieving content from multiple tables .. is possible?

I have 4 tables ...

"content" - Master list of content like title, desc, and contentType "albums" - Albums made up of several photos "photos" - Individual photo entries "photosLinks" - Links photos to album(s) "tags" - Tags used for searching and finding content

Is it possible to retrieve the photos for the content query if the contentType == 'album' in one query/shot?

For the tags, I can do a simple GROUP_CONTACT() since all we need is the text of the word.

I am not sure of the best approa开发者_JAVA技巧ch to handle if(an album) other than reading the result (from php) and then making another query to get the photos linked.

Any tips or advice will be appreciated. Thanks!!

Thomas


It's possible, but you'd end up with duplicate rows. I.e. you could just join, but you'd end up with something like:

Artist         Album               Photo
Cowboy Mouth   Are you with me?    [[Front Cover]]
Cowboy Mouth   Are you with me?    [[Back Cover]]

If you want some way of associating more than one row in one table to a single row of the result, then I am not aware of a means of doing that. You could do something like store a serialized data structure for one of the photo lists, but that of course doesn't follow the RDBMS philosophy too well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜