Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Post Unanswered: Compare strings which resembles each other

    Hy, I have a table containing some rows. Each row contains a field name which is of type String.

    For example:
    in row1 string1 is "Adieu Poulet",
    in row2 string2 is "Adieu a Poulet",
    in row3 string3 is "Adiue Poulet",
    in row4 string4 is "Adieu Pouleet", etc..
    (That is each string resembles each other a bit, they are somewhat similar to each other)

    What type of query should I make so as it return me all these string. That is I watn a query which return me strings which are similar or somewhat similar to each other.

    thanks in advance

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    strings

    This can't be done not with normal sql-commands

    maybe you are writing a storedprocedure which does something to the selected field
    But this wouldbe not that easy
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  3. #3
    Join Date
    Nov 2003
    Location
    Poland
    Posts
    7

    Re: Compare strings which resembles each other

    You may try to use like keyword with the right pattern, but its very limitted on bigger scale. So intsall plpgsql on your server and create stored procedure. String functions that come with postgresql should help you a lot


    Originally posted by gulshan
    Hy, I have a table containing some rows. Each row contains a field name which is of type String.

    For example:
    in row1 string1 is "Adieu Poulet",
    in row2 string2 is "Adieu a Poulet",
    in row3 string3 is "Adiue Poulet",
    in row4 string4 is "Adieu Pouleet", etc..
    (That is each string resembles each other a bit, they are somewhat similar to each other)

    What type of query should I make so as it return me all these string. That is I watn a query which return me strings which are similar or somewhat similar to each other.

    thanks in advance

  4. #4
    Join Date
    Jan 2004
    Posts
    26

    Re: Compare strings which resembles each other

    I don't have experience on Postgre but you can look for functions call like soundex, compare. Take a look to PHP that brings some functions to do string comparisons.

    I have the same problem with some more complications. If you find an answer, please, send me an email or something.
    I could resolve something working on MS-SQL with a function call compare, but I have millons of records to fix.

  5. #5
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    Postgres supports regex in queries;

    http://www.postgresql.org/docs/curre...S-SQL99-REGEXP

    The SIMILAR TO operator returns true or false depending on whether its pattern matches the given string. It is much like LIKE, except that it interprets the pattern using SQL99's definition of a regular expression. SQL99's regular expressions are a curious cross between LIKE notation and common regular expression notation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •