|
|
 |
| 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 tens of thousands of computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other programmers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
|
 |

July 10th, 2009, 01:18 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 201
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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 01:57 PM.
|

July 10th, 2009, 04:35 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,354
Thanks: 3
Thanked 72 Times in 71 Posts
|
|
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.
|

July 10th, 2009, 04:59 PM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Location: OKC, OK, USA.
Posts: 218
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |