0
I would like to display the sum of several rows, only in two columns. All information is in the same table. Only the criteria change.
Ex: I want the SUM of a column with WHERE and I want the SUM of the same column only with another WHERE. And these values are shown in two columns (SUM1 and SUM2).
I’m wearing it like this, but it comes in lines:
SELECT 
     SUM(ITEMSAIDA.NVLRUNITARIO), 
     ITEMSAIDA.NCODLINHAMERC, 
     ITEMSAIDA.NCODVENDEDOR 
  FROM ITEMSAIDA 
  WHERE 
     ITEMSAIDA.CNPJ = 'XX.XXX.XXX/0001-XX' AND 
     VENDEDOR.CNPJ =  'XX.XXX.XXX/0001-XX' AND 
     (
        ITEMSAIDA.NCODLINHAMERC = 13 OR 
        ITEMSAIDA.NCODLINHAMERC = 24
     ) 
  GROUP BY ITEMSAIDA.NCODVENDEDOR, ITEMSAIDA.NCODLINHAMERC
Thank you
you can use the
case when.. but it is not very clear the condition of each one. details the question better– rLinhares