Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2009, 12:18 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Question Add up quantities

I need to add gross and net quanties by "load" (which is the bill of lading number). My query still shows multiple rows with same load number (bol number)

Code:
 
select "load",
convert(varchar,Date,101),
branded,
name,
sum(cast(gross as decimal(15,2))), 
sum(cast(net as decimal(15,2)))
from [SFM-TP6000-1].TP6000.dbo.loadcomp as load1
inner join [SFM-TP6000-1].TP6000.dbo.product as prod1 on prod1.product = load1.branded
where load1.branded = 'ULS'

Last edited by snufse; July 10th, 2009 at 12:57 PM..
 
Old July 10th, 2009, 03:35 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

So where, in that, do you ever reference a bill of lading number???

And where is your GROUP BY, in any case.

Since this appears to be SQL Server (because of the "dbo." and the CONVERT with number 101), I can't believe you aren't getting an error message about the lack of GROUP BY.
 
Old July 10th, 2009, 03:59 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
Default

Snufse:

Need more information:
  • The BOL (Bill of Laden), in the Receiving Dept, defines what is on the Packing Slip. In the Shipping Dept, the BOL defined shipment and included additional info besides the detailed items, the order number and the truck ID, because some orders may be on multiple trucks, which meant multiple BOL with same order number. Need to know Receiving or Shipping?
  • Need you to define your "LOAD" besides saying its the BOL, Full Truck Load, Partial Truck Load, etc. and what is "UDS"?
  • It would help to know the process for receiving, before giving a response.
__________________
Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 18: Automation Add-Ins and COM Add-Ins David Bibby BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 1 April 10th, 2009 05:47 AM
Subtracting Quantities rsm42 ASP.NET 1.0 and 1.1 Basics 2 January 7th, 2007 10:44 AM
Updating Quantities rsm42 ASP.NET 1.0 and 1.1 Basics 1 December 26th, 2006 06:54 AM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 08:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.