SQL Column "Id" has been specified several times

Possible duplicate:
sql 2005 - the column has been specified several 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' has been specified several times for 'tb'.

+4
source share
2 answers

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

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

3D_Benchmarks has an id column, 3D_Slugs has an id column.

for explanation: [3D_Benchmarks] .id as help, 3D_Slugs.id as bid

-1
source

Source: https://habr.com/ru/post/1415036/


All Articles