MySQL Forums
Forum List  »  Newbie

Re: Subqueries for multiple queries on one table?
Posted by: Jay Pipes
Date: July 19, 2005 07:05PM

SELECT
SUM(IF((type = 1 OR type = 10) AND id='user', amount, 0)) as c1
, SUM(IF(type='2' AND id = 'user', amount, 0)) as c2
FROM t1;

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
Re: Subqueries for multiple queries on one table?
July 19, 2005 07:05PM


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.