-1

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

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user1111699
  • 15
  • 1
  • 3

1 Answers1

0

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
gofr1
  • 15,741
  • 11
  • 42
  • 52
Pramod Mangalore
  • 536
  • 5
  • 18
  • SELECT AspNetUsers.Id FROM [AspNetUsers] users >>> where the users comes from? INNER JOIN [<>] interpreter ON users.Id = Interpreter_Account.AspNetUserId WHERE Interpreter_Acount_email = @email – user1111699 Mar 11 '14 at 20:15
  • thank you pkamathk. that is the first time I use this forum I left asp.net 4 years ago on asp.net 2 and now doing a project on .net 4 – user1111699 Mar 11 '14 at 20:16
  • Thanks to all of you. the code that finally worked was: http://pastebin.com/xd6hgjGY – user1111699 Mar 13 '14 at 00:21