Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 7th, 2004, 09:34 AM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to coolest_pie
Default How to filter data?

Hi,
I have two tables of same structure on SQL server 2000
table structure:
1.name
2.address
3.telephone

Now, table A containes over 10000 records adn table B contains around 500 records. Also, table B contain some data which are already present in table A and some are not present in table A.

Now I want to filter these data into two different tables which are present in table A and which are not in table A.

How this can be done on SQL server 2000. Can anyone suggest me some procedure code to help me out.
Im in dire need of it...please help me out.

Looking for an earliets post!!!

:(jay



 
Old May 7th, 2004, 10:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default


You can use JOIN and IN statements to make these checks.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 7th, 2004, 11:37 AM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to coolest_pie
Default

but how...im an newbie...

Can you please help me with extact code that can run on SQL SERVER 2000 using structure of the table mentioned.

I would be obliged for any kind of help.

Thanks in advqnce!!!!

 
Old May 7th, 2004, 11:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

No, I can't write your code for you. I gave you a pointer to the solution by telling you what commands to use. Now search on google and learn about these commands.

Or, if you wish, you can pay me to write the code for you. It is what I get paid to do- why should I give it away free?



Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 7th, 2004, 11:52 AM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to coolest_pie
Default

im not asking you to write code for me...i am asking all people on net to help me out...if they can???




 
Old May 7th, 2004, 01:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you want to trade, please get off. This is the place where we share our knowledge and make others too grow.

Jay, here you go.

There are different ways to get there.

For count of similar records
Code:
Select count(b.*)
from TABLEB b, TABLEA a
where b.Name=a.Name
For listing similar records
Code:
Select b.*
from TABLEB b, TABLEA a
where b.Name=a.Name
For listing unmatched records, (Considering that TABLEB has the unmatched records)
Code:
Select b.*
from TABLEB b, TABLEA a
where b.Name<>a.Name
OR

Code:
Select b.*
from TABLEB b
where b.Name NOT in (Select a.Name from TABLEA a)
You can also use IN operator to achieve this.
If you are interested, I would post that too describing how to do that.

There is always someone to help.

Cheers!

-Vijay G
 
Old May 7th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

No Vijay, I want him to do his own job and not ask me to do it for him. I told him how it can be done. Giving him the code doesn't help him learn how to do a similar thing in the future.

Since WROX is about learning (that's why the books are there, to teach). It seems like the best way to help him is to direct him to the answer - not give it to him. Help him LEARN how to do it for himself next time and you have really given him assistance.




Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 7th, 2004, 07:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hal,

Seeing the nature of the question, I thought he is kind of a beginner, So in order to make him get more interest in it I showed different ways to do that and go on from there. Kind of creating interest in him is what I wanted to do.

Didn't really wanted to make him lazy.

You are also right in a way.:)
Cheers!

-Vijay G





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADO Data Shape - Filter aggregate dwperry SQL Language 0 March 31st, 2008 10:40 AM
How to filter out unwanted data fdtoo SQL Server 2000 1 April 25th, 2006 10:44 AM
Filter multi-tier XML data island jayme27 XSLT 1 April 22nd, 2006 04:53 AM
FUNCTION FILTER DATA FROM SQL DATABASE abofoma00 Javascript 1 November 21st, 2005 11:28 AM
Filter Help mcloum Classic ASP Databases 2 November 10th, 2005 05:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.