SQL多次指定列“Id”

时间:2012-05-30 02:37:08

标签: sql sql-server tsql

  

可能重复:
  sql 2005 - The column was specified multiple times

  SELECT TOP(20) * 
    FROM (SELECT * 
            FROM [3D_Benchmarks] 
            JOIN [3D_Slugs] ON [3D_Benchmarks].Id = [3D_Slugs].BenchmarkId) AS tb 
ORDER BY tb.FPS DESC;

我收到此错误:

  

'tb'多次指定了列'Id'。

2 个答案:

答案 0 :(得分:14)

而不是select *使用select table.columnnametablename.*

答案 1 :(得分:-1)

SELECT * 
            FROM [3D_Benchmarks] 
            JOIN [3D_Slugs] ON [3D_Benchmarks].Id = [3D_Slugs].BenchmarkId) AS tb

3D_Benchmarks有id列,3D_Slugs也有id列。

for explame:[3D_Benchmarks] .id as aid,3D_Slugs.id as bid