如何使用WHERE加入下面的两个表? 我尝试了以下但我认为我没有正确地做到这一点:
$query = mssql_query('SELECT T_EQ.[ID],T_ASSIGNED.[ID] FROM [TestTABLE].[dbo].[T_ASSIGNED] WHERE [T_ASSIGNED].[A_T_N]="' . $contact_lastname .'" JOIN T_EQ ON T_ASSIGNED.[ID] = T_EQ.[ID]');
此问题是对此处提出的问题的扩展:MS SQL Conversion failed when converting the varchar value to data type int and JOIN two Tables
答案 0 :(得分:0)
它应该像
$query = mssql_query('SELECT T_EQ.[ID],T_ASSIGNED.[ID] FROM [TestTABLE].[dbo].[T_ASSIGNED] JOIN T_EQ ON T_ASSIGNED.[ID] = T_EQ.[ID] WHERE [T_ASSIGNED].[A_T_N]="' . $contact_lastname .'" );