I'm simply trying to find all the fields from tbl1 (MAST) where a row is different from tbl2 (TRANS)
Here's my query which seems like it *should* work, but it isn't returning anything at all.
SELECT MAST.*
FROM QueryTrx..SO_90_UDF_Sales_Order MAST, QueryMaster..SO_90_UDF_Sales_Order TRANS
WHERE
--UNIQUE KEY
TRANS.SalesOrderNumber=MAST.SalesOrderNumber
--UPDATEABLE FIELDS
AND (TRANS.Delivery_Date<>MAST.Delivery_Date
OR TRANS.Revision<>MAST.Revision)
so basically I'm joining on the pkey, and then seeing if any of the other fields are different. Here's some sample data.
for MAST
SalesOrderNumber Delivery_Date Revision
====================================================
701 2000-05-31 00:00:00.000 99
702 2000-05-31 00:00:00.000 NULL
703 2000-05-31 00:00:00.000 1
for TRANS
SalesOrderNumber Delivery_Date Revision
====================================================
701 2000-05-31 00:00:00.000 NULL
702 2000-05-31 00:00:00.000 NULL
703 2000-05-31 00:00:00.000 1
So 701 should come out because it is NULL in the TRANS, but 99 in MAST, but isn't catching this.
However my query will catch if the MAST table's value isn't NULL and is just different...this makes no sense to me.
thanks for any insight
Here's my query which seems like it *should* work, but it isn't returning anything at all.
SELECT MAST.*
FROM QueryTrx..SO_90_UDF_Sales_Order MAST, QueryMaster..SO_90_UDF_Sales_Order TRANS
WHERE
--UNIQUE KEY
TRANS.SalesOrderNumber=MAST.SalesOrderNumber
--UPDATEABLE FIELDS
AND (TRANS.Delivery_Date<>MAST.Delivery_Date
OR TRANS.Revision<>MAST.Revision)
so basically I'm joining on the pkey, and then seeing if any of the other fields are different. Here's some sample data.
for MAST
SalesOrderNumber Delivery_Date Revision
====================================================
701 2000-05-31 00:00:00.000 99
702 2000-05-31 00:00:00.000 NULL
703 2000-05-31 00:00:00.000 1
for TRANS
SalesOrderNumber Delivery_Date Revision
====================================================
701 2000-05-31 00:00:00.000 NULL
702 2000-05-31 00:00:00.000 NULL
703 2000-05-31 00:00:00.000 1
So 701 should come out because it is NULL in the TRANS, but 99 in MAST, but isn't catching this.
However my query will catch if the MAST table's value isn't NULL and is just different...this makes no sense to me.
thanks for any insight