Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 inner join

Author  Topic 

Dwish1372
Starting Member

7 Posts

Posted - 2009-02-01 : 18:12:36
Hey guys I'm trying to combine data from 2 different tables using Inner Join. First table is called scratch and second table called Users. Its my first time doing this so plz bear with me. I'm doing the following select command which works great for displaying the scratch table and sorting by users who have the highest score:

select RANK() OVER (ORDER BY game1+game2+game3 DESC) AS 'Rank', username, game1, game2, game3, game1+ game2+ game3 AS 'Total Score'

And then I'm trying to add 'Firstname' for the users to this output by doing a join with this command. But its giving me the error that says Ambiguous column name 'username'.

From [scratch]
INNER JOIN Users
ON scratch.Username = Users.Firstname

Dwish1372
Starting Member

7 Posts

Posted - 2009-02-01 : 19:47:50
nevermind - i figured it out :) needed to qualify username
Go to Top of Page
   

- Advertisement -