Jump to content

Recommended Posts

I hope I'm on the right track. I'm new to MySQL and I'm trying to compare specific rows within two different tables. Basically, what I'm trying to accomplish can be summed up like this:

 

If row1 in table1 contains something like row1 in table2 then return it.

 

This is what I have so far:

 

$query = "SELECT players_scrape.player_name, players.player_name "."FROM players_scrape, players "."where players_scrape.player_name LIKE '%players_scrape.player_name%' = players.player_name";

$result = mysql_query($query) or die(mysql_error());

// Print out the contents of each row into a table 
while($row = mysql_fetch_array($result)){
echo $row['player_name']. " - ". $row['player_name'];
echo "<br />";
}

 

From what I understand the "LIKE" function returns a row that is similar (not necessarily exact - http://www.webmasterworld.com/forum88/5627.htm). This if what I'm going for.

 

I think I understand how to compare rows from different tables effectively (http://www.tizag.com/mysqlTutorial/mysqljoins.php). What I'm having an issue with is comparing a little more loosely. For example:

 

row1 table1

smith, john

 

row1 table2

JOHN SMITH

 

...so that MySQL would return results like these.

Link to comment
https://forums.phpfreaks.com/topic/213071-joining-tables-where-this-like-that/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.