2008年9月4日星期四

[fw-db] $db->update(... Multiple tables

Hi, I have two tables

forum:
columns - id, total_posts

forum_thread:
columns - id, forum_id

I want to run this query because I only have the thread id and not the forum id. I do realize I could select the forum id in a previous query but that is an extra query to run.

UPDATE forum, forum_thread set total_posts = total_posts + 1 where forum_thread.id = 1 and forum_thread.forum_id = forum.id

Is there any way to do this using zend db or should do I have to create my sql manually. I'm thinking it would be nice if I could do something like $db->update(array('forum', 'forum_thread'), ......'

Cheers

没有评论: