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 September 2nd, 2004, 03:08 AM
Rumi Rumi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 Rumi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL Syntax

I need to compare the results of 2 queries, the queries in an individual capacity does work, but when combined the totals are incorrect. I am using an access database and programming in visual basic. The database structure is such that there is a product table with a list of all our products and 2 other tables that both reference the products table PLEASE HELP

Reply With Quote
  #2  
Old September 2nd, 2004, 04:14 AM
sjosse sjosse is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 3 sjosse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I think we can use some more details here.
Can you post the SQL statements.

Reply With Quote
  #3  
Old September 2nd, 2004, 04:33 AM
Rumi Rumi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 Rumi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SELECT Production.ProdCode, Pallets.ProdCode, Products.ProdDesc, Products.PackSize, Products.Category, Sum(Pallets.Quantity) AS PalletQuantity, Sum(Production.Quantity) AS ProductionQuantity, (ProductionQuantity-SumOFQuantity) as DiffUnits
FROM (Products Left JOIN Pallets ON Products.ProdCode = Pallets.ProdCode) Right JOIN Production ON Products.ProdCode = Production.ProdCode
Where Production.Date Between ? and ?
GROUP BY Production.ProdCode, Pallets.ProdCode, Products.ProdDesc, Products.PackSize, Products.Category;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > SQL Syntax


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 2 hosted by Hostway