如何在angularjs中使用相同的两个列名
我有两个表,它们与名为id(存储记录id)的列名相同。我在这两个表上使用一个内部联接,并获取两个表的id列。我在angularjs如何在angularjs中使用相同的两个列名,angularjs,sql-server,Angularjs,Sql Server,我有两个表,它们与名为id(存储记录id)的列名相同。我在这两个表上使用一个内部联接,并获取两个表的id列。我在angularjshttp.getRESTAPI中使用这个select查询。当RESTAPI抛出包含2列同名id的结果表时,我将其存储在scope变量中 问题是如何使用一个特定表的id 假设查询是 select t1.id,t2.id from table1 AS t1 INNER JOIN table2 AS t2 ON t2.product=t1.product_id 我将r
http.get
RESTAPI中使用这个select查询。当RESTAPI抛出包含2列同名id的结果表时,我将其存储在scope变量中
问题是如何使用一个特定表的id
假设查询是
select t1.id,t2.id
from table1 AS t1
INNER JOIN table2 AS t2 ON t2.product=t1.product_id
我将rest API的结果存储在范围变量中,
$scope.details=response.data.platform.record代码>
我在控制器的警报框中使用了以下语法,但不起作用,
$scope.details.id、$scope.details.t1.id
使用,将解决您的问题:
SELECT t1.id AS T1Id,
t2.id AS T2Id
FROM table1 AS t1
INNER JOIN table2 AS t2 ON t2.product = t1.product_id
在控制器中,您可以使用:
$scope.details.T1Id
$scope.details.T2Id
使用,将解决您的问题:
SELECT t1.id AS T1Id,
t2.id AS T2Id
FROM table1 AS t1
INNER JOIN table2 AS t2 ON t2.product = t1.product_id
在控制器中,您可以使用:
$scope.details.T1Id
$scope.details.T2Id
选择t1.id作为t1id,从表1中选择t2.id作为t2id作为t1内部联接表2作为t2上的t2。product=t1。product_id
使用别名选择t1.id作为t1id,从表1中选择t2.id作为t2内联接表2作为t2上的t2。product=t1。product_id
使用别名