I can't help think there are some NULLs kicking around here...
Adrian
------------------------------
message: 3
date: Wed, 7 Dec 2016 15:59:13 +0000
from: Marvin Radding <marvin.radding@xxxxxxxxxxxxxxxxxxxxx>
subject: RE: A Mystery SQL Problem 
Adrian,
All of them have the same date.
Thanks,
?
Marvin
No trees were killed in the sending of this message, but a large number of electrons were terribly inconvenienced 
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Burch, Adrian
Sent: Wednesday, December 07, 2016 7:56 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: A Mystery SQL Problem 
How many rows do you have in MMNYOVRP where the date matches your effective year?
Adrian
On 12/2/2016 5:20 PM, Marvin Radding wrote:
exec sql
    (SELECT count(*) into :count
       FROM ahpovrp
       WHERE ROEFDT = :effective_year);
 exec sql
     INSERT INTO MMNYOVRP
           (SELECT * FROM ahpovrp
              WHERE ROEFDT = :effective_year
              ORDER BY rocomp, rostcd, roplan, robenp);
When I execute the first SQL statement, COUNT is 100; but when the second statement the file MMNYOVRP contains 140 records.
I don't understand how this can be. Any ideas?
It's not clear to me either.  As a diagnostic, what do the 'extra' 40 rows look like?  Can you do an exception join between MMNY and AHP and find out what the deltas are?  That may shed some light...
--
  --buck
-------------------------------------------------------------------------------------------------------------------------------------------------
The Medical Protection Society Limited (MPS) is a company limited by guarantee. Registered in England No. 36142 at 33 Cavendish Square, London, W1G 
0PS. VAT number 524 251475.  MPS is not an insurance company. All the benefits of membership of MPS are discretionary as set out in the Memorandum 
and Articles of Association. This communication and any files transmitted with it are confidential and may be legally privileged. They are intended 
solely for the addressee, and access by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or 
use of any kind or description, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you have received 
this email in error, please contact the sender and then delete from your system. MPS cannot accept any responsibility for the accuracy or completeness 
of this message as it has been transmitted over a public network. If you suspect that this message may have been intercepted or amended, please contact 
the sender. If verification of this email is required please request a hard-copy version from the sender.
This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: 
http://www.star.net.uk
As an Amazon Associate we earn from qualifying purchases.