I have 2 tables. The first has 4 columns, patnumbr, rdate rtime, and totalcharge
(integer, date, time, and currency). It is linked to a second table in a 1 to many
relationship, where the columns are nearly the same....patnumbr, rdate, rtime, and
charge. Each row in the first table is linked to a group of rows in the second
table. The matching columns are the 1st 3 columns. As you might guess, the sum of
the charges in the second table is the value of totalcharge in the first table. Now
say something happens to corrupt the data, where the sum of the charges in the second
table does not match the value in totalcharge, and I need to find out which row in the
first table does not have the right value for totalcharge. Is there some really cool
select statement, with group by and having or other forms of SQL magic that will find
all off the rows in the first table that don't have the correct value in the
totalcharge column???? It's easy to do with a declare cursor, but I was hoping that a
select statement would work!
TIA!
Mike Sinclair