Jump to content

Inner Join


ckrudelux

Recommended Posts

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON table1.g_id=table2.g_id' at line 1

<?php	$select = mysql_query("SELECT table1.g_id, table2.g_id FROM table1 INNER JOIN table2 WHERE table1.u_id='1' and table2.m_id='1' ON table1.g_id=table2.g_id");	$count = mysql_num_rows($select);	echo $count;	echo mysql_error();?>

I haven't used inner join before so I'm not sure if I wrote the right statement here so I have no clue whats wrong.I have two tables I want to compare but only where u_id is equal to 1 in table1 and where m_id is equal to 1 in table2.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...