Re: [ACFUG Discuss] SQL Question

2007-01-21 Thread Brooks . Wilson
Assuming that you have properly joined the two tables you can try adding 
"DISTINCT" to the query.

A proper join between the tables normally results in distinct rows being 
return. If you simply include the table names in the FROM clause, you will 
get a cross-product join which will result in many duplicates. A proper 
join eliminates the duplicates be only joining rows between the tables 
where a primary key = a foreign key.

Sometimes you can join tables but still need to add "DISTINCT" ...

"SELECT DISTINCT * FROM tableA, tableB WHERE tableA.primaryKey = 
tableB.foreignKey"

Sincerely,

Brooks Wilson
Try not to become a man of success but rather to become a man of value. - 
Albert Einstein (1879-1955)

Federal Reserve Bank of Atlanta · 1000 Peachtree Street, N.E. · Atlanta 
Georgia 30309-4470
404.498.8178 · fax 404.498.8239 · [EMAIL PROTECTED]

 



"Singles Concepts, Inc." <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
01/19/2007 02:56 PM
Please respond to
discussion@acfug.org


To

cc

Subject
[ACFUG Discuss] SQL Question






Hey CF Crew,
 
I have a question concerning SQL;
 
I have two database tables.
 
I would like to merge and purge the two tables an end with result table 
that is free of duplicates.
 
I was seeking a application written in CF.
 
Thanks
Michael


gifsOwg9WWmJ2.gif
Description: GIF image


RE: [ACFUG Discuss] SQL Question

2007-01-19 Thread axunderwood
If the two tables are the same layout (same columns), you have an easy solution:
 
SELECT * INTO dbo.newTable FROM
(SELECT * FROM table1 UNION SELECT * FROM table2)

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Singles Concepts, 
Inc.
Sent: Friday, January 19, 2007 2:56 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] SQL Question


Hey CF Crew,
 
I have a question concerning SQL;
 
I have two database tables.
 
I would like to merge and purge the two tables an end with result table that is 
free of duplicates.
 
I was seeking a application written in CF.
 
Thanks
Michael




-

To unsubscribe from this list, manage your profile @ 

http://www.acfug.org?fa=login.edituserform



For more info, see http://www.acfug.org/mailinglists

Archive @ http://www.mail-archive.com/discussion%40acfug.org/

List hosted by http://www.fusionlink.com

-




Re: [ACFUG Discuss] SQL Question

2007-01-19 Thread Teddy Payne

Michael,
What database are you using?  I would typically avoid my CF scrubbing my
data.  In the SQL Server realm, I typically use a data transformation
process that I can automate with stored procedures.

Teddy

On 1/19/07, Singles Concepts, Inc. <[EMAIL PROTECTED]> wrote:


 Hey CF Crew,

I have a question concerning SQL;

I have two database tables.

I would like to merge and purge the two tables an end with result table
that is free of duplicates.

I was seeking a application written in CF.

Thanks
Michael





--

Adobe Certified ColdFusion MX 7 Developer
Atlanta CFUG (ACFUG): http://www.acfug.org



-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform


For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-



[ACFUG Discuss] SQL Question

2007-01-19 Thread Singles Concepts, Inc.
Hey CF Crew,

I have a question concerning SQL;

I have two database tables.

I would like to merge and purge the two tables an end with result table that is 
free of duplicates.

I was seeking a application written in CF.

Thanks
Michael



-

To unsubscribe from this list, manage your profile @ 

http://www.acfug.org?fa=login.edituserform



For more info, see http://www.acfug.org/mailinglists

Archive @ http://www.mail-archive.com/discussion%40acfug.org/

List hosted by http://www.fusionlink.com

-