Dude
Dude

Reputation: 1

how to remove duplicates in a row using sqlite having numbers which contains special characters

I have a question which is similar to Find the number of duplicates in a row using sqlite except that the numbers mentioned in the column may contain brackets too . For eg:

Name       Num0     Num1     Num2   Num3   Num4  Num5   Num6  Num7  
1)John     (12)34   1234     (123)4 

2)Hebbar   234   

3)Jim      (9)876     9876    (9876)

4)Kim      111     111     111

5)Kate     666

Now when i run sqlite the query i should be getting the results as John, Jim and Kim respectively. I am using C language for my project.

Thanks a lot in advance.

Upvotes: 0

Views: 49

Answers (1)

CL.
CL.

Reputation: 180020

To remove the parentheses, use replace() to replace them with an emptry string:

SELECT replace(replace(Num0, '(', ''), ')', '') AS Num0_without_parens,
       ...
FROM MyTable;

This can then be processed further, as shown in the linked question.

Upvotes: 0

Related Questions