Click here to Skip to main content
15,902,112 members
Home / Discussions / Database
   

Database

 
AnswerRe: selecting data from two tables Pin
Richard Deeming2-Apr-14 3:24
mveRichard Deeming2-Apr-14 3:24 
GeneralRe: selecting data from two tables Pin
Member 102635192-Apr-14 19:28
Member 102635192-Apr-14 19:28 
GeneralRe: selecting data from two tables Pin
Richard Deeming3-Apr-14 1:03
mveRichard Deeming3-Apr-14 1:03 
AnswerRe: selecting data from two tables Pin
Jörgen Andersson2-Apr-14 3:25
professionalJörgen Andersson2-Apr-14 3:25 
AnswerRe: selecting data from two tables Pin
Bernhard Hiller2-Apr-14 21:48
Bernhard Hiller2-Apr-14 21:48 
GeneralRe: selecting data from two tables Pin
Member 102635192-Apr-14 22:41
Member 102635192-Apr-14 22:41 
GeneralRe: selecting data from two tables Pin
Bernhard Hiller3-Apr-14 20:44
Bernhard Hiller3-Apr-14 20:44 
AnswerRe: selecting data from two tables Pin
BobWayne078-Apr-14 9:08
BobWayne078-Apr-14 9:08 
QuestionOracle Database Pin
Zeyad Jalil1-Apr-14 0:19
professionalZeyad Jalil1-Apr-14 0:19 
AnswerRe: Oracle Database Pin
thatraja3-Apr-14 1:02
professionalthatraja3-Apr-14 1:02 
QuestionSQL - Write Query with field names and table name stored in a table? Pin
Megan Jean27-Mar-14 11:11
Megan Jean27-Mar-14 11:11 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
PIEBALDconsult27-Mar-14 11:52
mvePIEBALDconsult27-Mar-14 11:52 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
Megan Jean28-Mar-14 4:51
Megan Jean28-Mar-14 4:51 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
PIEBALDconsult28-Mar-14 6:50
mvePIEBALDconsult28-Mar-14 6:50 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
Megan Jean28-Mar-14 12:17
Megan Jean28-Mar-14 12:17 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
PIEBALDconsult28-Mar-14 13:07
mvePIEBALDconsult28-Mar-14 13:07 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
Member 1071490931-Mar-14 22:45
Member 1071490931-Mar-14 22:45 
GeneralRe: SQL - Write Query with field names and table name stored in a table? Pin
PIEBALDconsult1-Apr-14 3:21
mvePIEBALDconsult1-Apr-14 3:21 
AnswerRe: SQL - Write Query with field names and table name stored in a table? Pin
GuyThiebaut28-Mar-14 5:31
professionalGuyThiebaut28-Mar-14 5:31 
QuestionRemove duplicate rows in multiple join query Pin
Eng Hasan Abbas25-Mar-14 7:56
Eng Hasan Abbas25-Mar-14 7:56 
AnswerRe: Remove duplicate rows in multiple join query Pin
Mycroft Holmes25-Mar-14 12:50
professionalMycroft Holmes25-Mar-14 12:50 
Underscore make that unreadable bleh...

What I do is a 2 query pass, the inside query uses ROW_NUMBER() and PARTITION OVER the key fields (those that make up the unique record)

I then delete records with a row number > 1

Here is a snippet I keep around for deduping
SQL
DECLARE @Tbl TABLE (IDField INT, RowNo INT)	

--insert the primary key (identity field)
INSERT @Tbl
SELECT lnkStrategyNodeID IDfield,

--partition over the unique constraints - order by is required and logically you should use the lowest ID field
ROW_NUMBER() OVER(PARTITION BY StrategyID,NodeID ORDER BY lnkStrategyNodeID) Rw
FROM lnkStrategyNode


--delete anything that is > 1
--SELECT * 
DELETE 
FROM  lnkStrategyNode 
WHERE lnkStrategyNodeID IN (SELECT IDField FROM @Tbl WHERE RowNo > 1)

Never underestimate the power of human stupidity
RAH

AnswerRe: Remove duplicate rows in multiple join query Pin
Chris Quinn25-Mar-14 22:02
Chris Quinn25-Mar-14 22:02 
AnswerRe: Remove duplicate rows in multiple join query Pin
Member 1071490931-Mar-14 22:55
Member 1071490931-Mar-14 22:55 
QuestionOracle Error Pin
Member 867725124-Mar-14 19:49
Member 867725124-Mar-14 19:49 
AnswerRe: Oracle Error Pin
Kornfeld Eliyahu Peter24-Mar-14 20:13
professionalKornfeld Eliyahu Peter24-Mar-14 20:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.