SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL COMPARE HELP!!!


SQL COMPARE HELP!!!

Author
Message
gh449
gh449
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
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
anthony.green
anthony.green
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24792 Visits: 6519
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
When a question, really isn't a question - Jeff Smith
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


Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)

Group: General Forum Members
Points: 96033 Visits: 38980
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.

Cool
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)
gh449
gh449
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 12
I tried that getting dozens on duplicates on the output file? Thank you!!!!
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)

Group: General Forum Members
Points: 96033 Visits: 38980
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.

Cool
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)
ChrisM@Work
ChrisM@Work
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41963 Visits: 20008
-- 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
gh449
gh449
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 12
Thank you very much. This is amazing!!!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search