Appending Unique Rows

Appending Unique Rows

Post by J. Josh » Wed, 28 Jan 2004 00:05:56



Hello all,

I have a data set that needs to be appended to a temp
table. This data-set has unique rows appearing twice. How
do I add append this data-set in the temp table as
appearing just once.

Here's what the data looks like:

ID   CARRIER    CNT
===================
1    AIR         2
3    AIR3        2
7    AIR0        2

Thanks in advance.

Joshi

 
 
 

Appending Unique Rows

Post by Anith Se » Wed, 28 Jan 2004 00:11:58


Guessing...

INSERT #tmp (keycol,....)
SELECT keycol, ...
  FROM sourcetbl
 WHERE NOT EXISTS (SELECT *
                     FROM #tmp
                    WHERE keycol = sourcetbl.keycol);

--
Anith

 
 
 

1. How to select unique rows in terms of unique column value

if a table t contains values:

name     v
a       10
b       20
b       14
d        3
e        1
a       12

what I want is: select name, v where name is unique, as

name    v
a       10   -- v for a could also be 12
b       20   -- v for b could also be 14
d       3
e       1

Can idea?

--
Thanks
John Wu
Toronto

2. Converting from Jet to ODBCDirect

3. unique active rows, duplicate inactive rows

4. Open Server TDS Passthrough

5. Inserting unique rows - last row skipped ???

6. Number vs Number(x)

7. DTS: Help appending data- rejecting duplicates based on unique key in target

8. tool for migrating stored procedures from oracle to sqlserver ??

9. Fastest way to append unique record to .mdb

10. Importing (append or copy) only unique values

11. Appending Rows to Columns

12. Deleting/appending rows in SQL 6.5

13. Append Rows?