Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select the top 10 non-matching records using SQL

Status
Not open for further replies.

3pmilk

MIS
Jun 20, 2002
46
US

Hi all,

I'm creating a VBA/ACCESS app that contains two listview boxes: listview box A and ListView B. Each Listview box contains a list of project IDs. The user has the option of choosing a project from each listview box and compare their results. I have written a query to retrieve data from the tables IF the user were to select the "correct projects" to do the comparison to begin with, but if they were to select the wrong projects (project ids) and do the comparison, then the query runs forever....and ultimately it just hangs. So, this leads me to create another query that says if the first 10 records between these two selected project don't match (via their control account ids, and etc), then pop a message box up saying, " wrong projects." How do I go about and do that?


I know you can select top N select list from table name, not sure how to incorporate that into my program...


Thanks for all your help

 
If you're asking how to go about selecting just the first ten records in the query....

SELECT TOP10 Field1, Field2, etc FROM Table1, Table2, etc WHERE etc


Randy
 
Thanks, Randy, for the example.

What I'm interested in is what if I want to select the top 10 records that don't match from in table 1 and 2. How do I do that?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top