Link to home
Start Free TrialLog in
Avatar of Gary Brett
Gary Brett

asked on

Include multiple fields included in crosstab query

Is it possible at all to include multiple fields included in crosstab query? For example in below code I now have 2 fields I need to look at as below:

SELECT
  IfNull(c.Adviser, 'GRAND TOTAL') AS Adviser,
  Sum(CASE WHEN Month(i.CompDate) = 1 THEN i.comms + i.broker_fee + i.legal_fees ELSE 0 END) Jan,

Open in new window



What I now need if possible:
Sum(CASE WHEN Month(i.CompDate) = 1 THEN i.comms ELSE 0 END) OR Sum(CASE WHEN Month(i.signedupdate) = 1 THEN i.legal_fees ELSE 0 END)  Jan,

Open in new window



Does that make any sense?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.