MySQL Forums
Forum List  »  Newbie

Re: Pulling my hair out with this query
Posted by: Reo Lucas
Date: August 12, 2005 09:44AM

Thanks Aziz!

Someone showed me another technique using CASE:

, sum(case when `YEAR` = 2002
then TEST1 end) as total2002
, sum(case when `YEAR` = 2003
then TEST1 end) as total2003
, sum(case when `YEAR` = 2004
then TEST1 end) as total2004
FROM mydata
by NAME";

I'm trying now to figure out which of the two methods is the more efficient method (given about 1 million records).

Options: ReplyQuote

Written By
Re: Pulling my hair out with this query
August 12, 2005 09:44AM

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.