Link to home
Start Free TrialLog in
Avatar of Dolamite Jenkins
Dolamite JenkinsFlag for United States of America

asked on

can i create a command insert or replace WHERE ( based on data in non unique id colum)

I wanna eliminate duplicates , for a number of reasons if can't use my unique Identifier... is there a command that I can use ....I am currently using insert or replace and I know that this command is dependent on the unique Id... but my next column generates a random number that is assigned to every entry... can i create a command insert or replace WHERE ( based on random column data) ... can I do this and how .... Im using sqlite3 and python 2.6
Avatar of arnold
arnold
Flag of United States of America image

You can do that, but it could update multiple rows.

you can use like ='%pattern%'

Avatar of Dolamite Jenkins

ASKER

Thanks Im new what is like pattern
Too confuse for me.

INSERT/REPLACE data WHERE ???

I did understand.

If you need to get data with no duplicates you can use something like

SELECT sub.columns, YOUR_RANDOM_NUMBER
FROM (SELECT DISTINCT column FROM table WHERE conditions) sub

ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks