SunQuest
           MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old March 4th, 2004, 05:43 PM
lkaegi lkaegi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 lkaegi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Problems With Sum...

Hi all,

Ok. Ive want to make a querie that sums values from different tables, for example daily sales(wich are in sales detail table), daily outgoing products(with are in an outgoing detail table) and daily incoming products(wich are in a incoming detail table) *** sorry for outgoing and incoming, dont know if i used the correct terms***. So I do a sum(prod_sales),sum(prod_out),sum(prod_in) grouping them by product id. When i query the tables the answers are completly out of bounds

heres my query:

select Productos.ProdId,sum([detalle facturas].ProdCant) as Ventas,sum([detalle facturas].Boncan) as Bonificaciones,sum([detalle salidas de producto].ProdCant) as Salidas,sum([detalle entradas de producto].ProdCant) as Entradas from facturas,[detalle facturas],[salidas de producto],[detalle salidas de producto],entradas,[detalle entradas de producto],productos
where facturas.facid = [detalle facturas].facid and [salidas de producto].salnum = [detalle salidas de producto].salnum
and entradas.entnum = [detalle entradas de producto].entnum and [detalle facturas].prodid = productos.prodid and
[detalle salidas de producto].prodid = productos.prodid and [detalle entradas de producto].prodid = productos.prodid
Group By Productos.ProdId

Is there any way to make this query work giving me the correct values or do i have to query each table individually.

Any help will be great...

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Problems With Sum...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway