Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL COMPARE HELP!!! Expand / Collapse
Author
Message
Posted Monday, February 18, 2013 6:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 3:50 AM
Points: 4, Visits: 12
Hello,

I need to write a few lines of SQL that will suppress one file from another. I work in foxpro 2.6 for DOS (i know its old but it works for us) we have name and address files. We want to suppress one .dbf from another .dbf. Here is what i have but it wont work. HELP!!

Thanks!!
&&&& A prg to supress two files based on Z5, LN , AD - FEB 2013 GH
&&&& "FEBSUP.PRG" all standard files
SELECT * ;
FROM LARGE, small ;
WHERE LARGE.Z5 <> small.z5 and Large.ln <> small.ln and Large.fn <> small fn ;
ORDER BY LARGE.Z5 ;
INTO TABLE SUPP.DBF
Post #1421182
Posted Monday, February 18, 2013 6:52 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 2:20 AM
Points: 5,231, Visits: 5,106
You might be best asking that in a dedicated FoxPro forum not a Microsoft SQL Server forum.

Someone who knows FoxPro may stumble across the post and help, but I am not aware of many FoxPro people here.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1421188
Posted Monday, February 18, 2013 8:19 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 6:24 PM
Points: 23,397, Visits: 32,246
gh449 (2/18/2013)
Hello,

I need to write a few lines of SQL that will suppress one file from another. I work in foxpro 2.6 for DOS (i know its old but it works for us) we have name and address files. We want to suppress one .dbf from another .dbf. Here is what i have but it wont work. HELP!!

Thanks!!
&&&& A prg to supress two files based on Z5, LN , AD - FEB 2013 GH
&&&& "FEBSUP.PRG" all standard files
SELECT * ;
FROM LARGE, small ;
WHERE LARGE.Z5 <> small.z5 and Large.ln <> small.ln and Large.fn <> small fn ;
ORDER BY LARGE.Z5 ;
INTO TABLE SUPP.DBF


Try changing the ANDs to ORs in the WHERE clause.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1421241
Posted Monday, February 18, 2013 8:52 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 3:50 AM
Points: 4, Visits: 12
I tried that getting dozens on duplicates on the output file? Thank you!!!!
Post #1421249
Posted Monday, February 18, 2013 9:19 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 6:24 PM
Points: 23,397, Visits: 32,246
gh449 (2/18/2013)
I tried that getting dozens on duplicates on the output file? Thank you!!!!


Confused. Did it help or not?

If not, what is the problem. I am not a Foxpro developer but this does appear to be basic SQL. The only thing I see missing in the query is a join between the data in the tables.

Not being able to see what you see makes it even harder.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1421263
Posted Tuesday, February 19, 2013 12:57 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, September 12, 2014 9:43 AM
Points: 7,284, Visits: 13,824
-- Collect the matches
SELECT l.ID ;
FROM LARGE l ;
INNER JOIN small s ;
ON s.ID <> l.ID ;
AND LARGE.Z5 = small.z5 and Large.ln = small.ln and Large.fn = small.fn ;
INTO TABLE SuppressedRows.DBF ;

-- Then use the ID's to restrict table LARGE
SELECT l.ID ;
FROM LARGE l ;
WHERE l.ID NOT IN (SELECT ID FROM SuppressedRows) ;
INTO TABLE SuppressedRows.DBF ;

-- You might be able to do this in one step (it's a while since I've used Foxpro SQL)
SELECT l.ID ;
FROM LARGE l ;
WHERE l.ID NOT IN ( ;
SELECT l.ID ;
FROM LARGE l ;
INNER JOIN small s ;
ON s.ID <> l.ID ;
AND LARGE.Z5 = small.z5 and Large.ln = small.ln and Large.fn = small.fn) ;
INTO TABLE SuppressedRows.DBF ;



“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1421460
Posted Tuesday, February 19, 2013 3:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 3:50 AM
Points: 4, Visits: 12
Thank you very much. This is amazing!!!
Post #1421523
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse