0

enter image description hereI want to select the soundex value S225  for the two names

This is what iried using this query but am not getting the exact result.

I got the output with the same name and same soundex value, but I want the result which has similar name and same soundex value.

Can anyone help me to do this?

2
  • Please give some examples that you'd like to find. How similar is similar? Commented Jul 9, 2015 at 11:06
  • 1
    And please do not post SQL statements as screen shots. Show the statements as formatted text.
    – user1822
    Commented Jul 9, 2015 at 11:14

1 Answer 1

2

You can use a window function for this:

select *
from (
   select name, 
          count(*) over (partition by soundex(name)) as cnt
   from poi
) t
where cnt > 1;
3
  • It Works...................... Thank u so much ...a_horse_with_no_name. then, what does the variable 't' stands for in that query? Commented Jul 9, 2015 at 11:46
  • 1
    @MohamedAshrafAliB it's not a variable but a mandatory table alias for a subquery. Commented Jul 9, 2015 at 11:59
  • @a_horse_with_no_name Commented Jul 22, 2015 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.