2012-10-30 38 views
0

我在mysql中的內部連接語句有問題。我有兩個表一個是信息和其他是student.What我希望當在信息表L-NAME LNAME學生表和值的值相同,則選擇從FNAME了information.I錯誤...兩個表之間的內部連接顯示錯誤

$grad_stu1 = mysql_query("SELECT information.fname FROM information INNER JOIN student ON student.lpatel == information.lname;") or die($myQuery."<br/><br/>".mysql_error());  
+1

MySQL的(和大多數其他RDBMS)平等歌劇tor是'='不是'=='。 –

+1

錯誤消息應該告訴你。你能否檢查錯誤信息是否足夠清晰? –

+1

爲了將來的參考,請仔細閱讀錯誤消息,如果他們看起來神祕的谷​​歌他們,如果他們仍然在困擾你至少張貼消息與你的問題。 – TheZ

回答

4

MySQL

SELECT `information`.fname 
FROM  `information` 
     INNER JOIN student 
      ON student.lpatel = `information`.lname 
+0

其working.thanks –

1

使用單=應該===

$grad_stu1 = mysql_query("SELECT information.fname FROM information 
          INNER JOIN student ON 
          student.lpatel = information.lname;") 
          or die($myQuery."<br/><br/>".mysql_error());