× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello all,

I'm having a problem getting an SQL statement to work properly. Here is my
scenario:

I have two tables:

Order Header
Order Hold Detail.

The requirement is to get one row per customer showing the customer and a
total for all orders. Easy enough. Now here's the kicker. I need to check
the Order Hold Detail for Open Order Hold records (rmvdate = 0).
Here is the statement I'm using:

SELECT cusno,sum(ordtot) FROM oeordh a left outer join Orhlact b on
a.ordno = b.ordno and a.ordlv = b.ordlv and a.ordlv = b.ordlv WHERE
cusno = 304100 and rmvdate = 0 GROUP BY cusno

Customer Number 304100 has one open order totaling 45.00. However there are
5 open hold codes for this order. Hence, the sum(ordtot) is returning
225.00.

Any thoughts would be appreciated.


Thanks,

Mark


Mark Walter
Sr. Programmer/Analyst
Hanover Wire Cloth a div of CCX, Inc.
mwalter@hanoverwire.com
http://www.hanoverwire.com
717.637.3795 Ext.3040



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.