Question

I am trying to do a simple inner join to select a row or even just get ID from inner join of 2 tables, one is the regular ASP.NET users table and the other one is mine (interpreters) somehow my syntax is not accessible -

http://pastebin.com/4aDPrtst

I think it expect something like

[Common].[tbl_Interpreter_Account].[AspNetUsers]

with all the [][][][ but I am not sure

Was it helpful?

Solution

Assuming [Common] is your database schema and [AspNetUsers] is the table automatically created using membership services (or by some other means), I'm unsure what [tbl_Interpreter_Account] refers to. Could you please clarify?

Also the join needs to be corrected. You're joining what appears to be the following two tables: AspNetUsers and AddIntrepeter. But the join condition is on some other table Interpreter_Account

Try the following:

Insert your databasename at the top of the procedure.

USE [Common]

CREATE PROCEDURE [dbo].[GetIntIdByEmail]
    @email  nvarchar(50)
AS
SELECT 
AspNetUsers.UserName
FROM [AspNetUsers] users 
INNER JOIN  [<<Your_Table>>] interpreter ON users.Id = interpreter.<<your_Matching_Column>>
WHERE interpreter.contact_email = @email
GO
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top