7

Possible Duplicate:
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;

I Get This Error:

The column 'Id' was specified multiple times for 'tb'.

Community
  • 1
  • 1
Mario
  • 13,941
  • 20
  • 54
  • 110

2 Answers2

14

Instead of select * use select table.columnname or tablename.*.

Yaqub Ahmad
  • 27,569
  • 23
  • 102
  • 149
  • 5
    but I have 20 columns, there must be a simpler way, maybe assigning the columns with the Id with AS – Mario May 30 '12 at 13:30
  • 1
    `tablename.*` did it for me. I only needed to select from one table. Thanks! – tedi Oct 04 '17 at 06:20
0
SELECT * 
            FROM [3D_Benchmarks] 
            JOIN [3D_Slugs] ON [3D_Benchmarks].Id = [3D_Slugs].BenchmarkId) AS tb

3D_Benchmarks have id column,3D_Slugs have id column too.

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

maco_wang
  • 21
  • 1