MySQL Forums
Forum List  »  Newbie

Re: Doing calculations in linked tables.
Posted by: David Ashman
Date: January 25, 2008 11:28AM

Something like...

CREATE VIEW asset_status AS
SELECT assets.id, assets.name, SUM(tasks.status)/COUNT(*) as overall_status
FROM assets, tasks
WHERE assets.id = tasks.linked_asset_id
GROUP BY assets.name;

should work!

Options: ReplyQuote


Subject
Written By
Posted
Re: Doing calculations in linked tables.
January 25, 2008 11:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.