Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-21-2007, 12:15 PM Select similar rows
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
the ideea is that i have a table that has a name field ... and i will like to select the similar entries to try and eliminate the duplicates. The thing is i will love to find a way to not limit to exact match ...
ex : title_name similar to : titlename, TitleName, title name1

I can imagine a way to do this ... but i would like to ask you guys wich will be the best/quickest/less use of resurce way. I am tring to do this in as few sql querys as possible.

Thank you so much
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
 
Register now for full access!
Old 10-21-2007, 03:40 PM Re: Select similar rows
Inet411's Avatar
Skilled Talker

Posts: 88
Name: programmer
Location: internet
Trades: 0
Quote:
Originally Posted by solomongaby View Post
the ideea is that i have a table that has a name field ... and i will like to select the similar entries to try and eliminate the duplicates. The thing is i will love to find a way to not limit to exact match ...
ex : title_name similar to : titlename, TitleName, title name1

I can imagine a way to do this ... but i would like to ask you guys wich will be the best/quickest/less use of resurce way. I am tring to do this in as few sql querys as possible.

Thank you so much

I might not understand perfectly but here is what I'd do:

PHP Code:
$res mysql_query("SELECT * FROM table_name WHERE field_name LIKE '%$query%'");
if (
mysql_num_rows($res) > '0') {
for (
$i=0;$i<mysql_num_rows($res);$i++) {
$title mysql_result($res,$i,"title_field";
echo (
"$title <br />");
}

I'm sure someone else can modify my logic to make it more efficient, but that should work.
Inet411 is offline
Reply With Quote
View Public Profile Visit Inet411's homepage!
 
Old 10-22-2007, 04:34 AM Re: Select similar rows
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
the problem with you're solution ( that was my first ideea too ) is that i have to run the query for each row ... to find out wich has duplicates and wich don't
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 10-22-2007, 05:20 AM Re: Select similar rows
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
Why don't you set the field to unique?
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Select similar rows
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13939 seconds with 12 queries