MySQL Forums
Forum List  »  General

Re: Column specific WHERE clauses?
Posted by: Peter Brawley
Date: October 26, 2018 11:04AM

A crosstab or pivot table, see that subject at https://www.artfulsoftware.com/queries.php

Something like ...

select 
  avg( if(errorcode='E0',val1,null) ) as EO, 
  avg( if(errorcode='E1',val2,null) ) as E1 
from table
group by grp;

('Group' is a reserved word.)

Options: ReplyQuote


Subject
Written By
Posted
Re: Column specific WHERE clauses?
October 26, 2018 11:04AM


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.