"Brandon, Nicholas (UK)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a table with first_name and a last_name column. I would like to > find similar duplicates by finding the same last_name and matching the > first two characters of the first name. Therefore if the table has the > following rows: > > Ind_id last_name first_name > 100 Smith david > 101 Smith dave > 102 Smith irene > > I would like it to pick out the top two rows. I'm using the following > but while the syntax is correct the last where expression below is > wrong: > > select * from current as x, current as y where x.last_name = > y.last_name and x.ind_id != y.ind_id and x.first_name like > substr(y.first_name, 0,2)
You probably want x.first_name like substr(y.first_name, 1,2) || '%' or substr(x.first_name, 1, 2) = substr(y.first_name, 1, 2) Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users