Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing two SQL cursors
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00239523
Message ID:
00239544
Views:
13
SELECT *,'tabl1' AS whichtable FROM cFirstSQL UNION ;
SELECT *,'tabl2' AS whichtable FROM cSecondSQL ;
INTO CURSOR bothtables
Those records where whichtable is 'tabl2' are in cSecondSQL but not in cFirstSQL (but duplicates in cSecondSQL that aren't in cFirstSQL are also eliminated). For ones that are unique in cFirstSQL just reverse the order of SQL statements in the above union. This works because a SQL union without the ALL keyword will eliminate exact duplicate records from the result set.
Good luck.

>I have pulled data from two separate SQL tables, and I need to find which rows are different. They have exactly the same structure.
>
>I have the two views which I will call cFirstSQL and cSecondSQL and I did the following thinking that this would work;
>
>SELECT * from cFirstSQL WHERE NOT EXSISTS (SELECT * FROM cSecondSQL)
>
>I get not data, and there are differences.
Previous
Reply
Map
View

Click here to load this message in the networking platform