Skip to Content
author's profile photo Former Member
Former Member

Agregar Campo Suma de una Columna a una Query?

Estimados tengo la siguiente consulta y quisiera agregar al final de la última columna la suma de 'valor de stocks'

Alguien sabe si se puede hacer? adjunto query e imagen de lo que necesito..


Select 'Alcapharma' 'Empresa', a.itemcode, a.itemname, d.itmsgrpnam, convert(int,a.onhand) 'Stock Total', convert(int,c.onhand) 'Biomedicals', convert(int,y.onhand) 'Pharma ISA' , convert(int,x.onhand) 'Retenidas Biomedicals', convert(int,z.onhand) 'Retenidas Pharma ISA', convert(int,a.iscommited) 'Reservado', convert(int,(a.onhand - a.iscommited)) 'Disponible', convert(int,a.onorder) 'Solicitado', convert(int,(a.onhand + a.onorder - a.iscommited)) 'Disponible + Solicitado', a.lstevlpric, a.avgprice, a.lastpurprc, a.stockvalue

from oitm a inner join oitw b on a.itemcode = b.itemcode and b.whscode = 'b01' inner join oitw c on a.itemcode = c.itemcode and c.whscode = 'b07' inner join oitb d on a.itmsgrpcod = d.itmsgrpcod inner join oitw x on a.itemcode = x.itemcode and x.whscode = 'b04' inner join oitw y on a.itemcode = y.itemcode and y.whscode = 'b06' inner join oitw z on a.itemcode = z.itemcode and z.whscode = 'b08'

where d.itmsgrpnam = 'Medicamentos Reg.' or d.itmsgrpnam = 'Artículo 21' and a.onhand > '0'

order by a.stockvalue desc

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 27, 2015 at 12:23 PM


    si te sitúas en la cabecera del informe, sobre el nombre de una columna numérica, y haces CTRL + doble clic, en la parte inferior del informe se mostrará el total.

    Un saludo

    Agustín Marcos Cividanes

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.