Erro while join table in SQL

Posted by Color Shadow on Stack Overflow See other posts from Stack Overflow or by Color Shadow
Published on 2012-09-15T15:25:58Z Indexed on 2012/09/15 15:37 UTC
Read the original article Hit count: 119

Filed under:
|
|

I have two tables that have relationship with UserName field. Based on UserName column, I want to get ID from CarReserve table. Here is my SQL statement:

SELECT CarReserve.ID 
FROM CarReserve 
 INNER JOIN aspnet_Users ON CarReserve.UserName = aspnet_Users.UserName 
WHERE UserName = @UserName

Unfortunately, I am getting this warning:

Ambiguous column name "UserName"

Can anyone here tell me what is wrong with my statement?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET