Try this:
SELECT COMPANY, ORDERNUMH FROM ORDERHEAD
Where ORDERNUMD not in(select ORDERNUMD from ORDERDETL)
WHERE SHIPDATE = 20071101
OR
If you need to condition the line item for '/6'
SELECT COMPANY, ORDERNUMH FROM ORDERHEAD
Where ORDERNUMD not in(select ORDERNUMD from ORDERDETL where item number
= "/6")
WHERE SHIPDATE = 20071101
John Arnold
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Grizzly Malchow
Sent: Friday, November 02, 2007 1:01 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL Help
I'm trying to find out which shipments are missing a shipping charge.
Shipping charges appear on an order as a line item with the item number
= '/6'. I'm planning on using SQL, but I'm not quite sure about the
syntax.
I'm able to select shipments based on shipment date, but what I can't
figure out is how to check to see if one of the line items is the
shipping charge, or better yet only select those orders that do not have
a shipping charge.
Here's my syntax right now.
SELECT COMPANY, ORDERNUMH FROM ORDERHEAD
INNER JOIN ORDERDETL ON ORDERNUMD = ORDERNUMH
WHERE SHIPDATE = 20071101
This selects all orders and items for the specified ship date. I'd like
to trim that down to only select the orders that don't have an item
number = '/6'
Can anyone offer some suggestions?
Thanks in advance.
Griz
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.