User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,760 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 1688 | Replies: 0
Reply
Join Date: Dec 2007
Posts: 1
Reputation: luizcruz is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
luizcruz luizcruz is offline Offline
Newbie Poster

Query sum(Case...) help!!!

  #1  
Dec 1st, 2007
hello there...
i need help with cross tab query with sum(case actually iam using ms access 2007 and vb.net 2005 i have problems with the sintaxis ill paste the code below:

TRANSFORM SUM(cantidad*(case tipo WHEN 'Entrada' else 1 then 1 end 0)-cantidad(case tipo WHEN 'Salida' else 1 then 0 end)) AS TOTAL
SELECT S.nombre,S.grupo,SUM(cantidad) AS Sub
FROM Movimiento AS M, Punto AS P, Sorteo AS S
WHERE(M.id_sorteo = s.id_sorteo And M.id_punto = P.id_punto)
GROUP BY P.nombre, S.nombre, S.grupo ORDER BY grupo PIVOT P.nombre"

i need the correct sintaxis for this sentece:
SUM(cantidad*(case tipo WHEN 'Entrada' else 1 then 1 end 0)-

or another way to do this , the finally of this query is get the actual inventory.

regards, hope anyone could help me
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 9:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC