Search the Community
Showing results for tags 'inner'.
-
Hi.Wonder if you can help, am quite new to SQL. In simple terms, I have a transaction table - and in that table are references to other related tables. In this simple query I am trying to obtain the first name and last name from the user ID for a transaction. SELECT transaction.transactionId, user.firstName, user.lastNameFROM [transaction]INNER JOIN [user]ON transaction.userId = user.userIdORDER BY user.userId However I get the response "incorrect syntax near the keyword transaction". I then try: SELECT 'transaction'.transactionId, user.firstName, user.lastNameFROM [transaction]INNER JOIN [user]ON 'transaction'.userId = user.userIdORDER BY user.userId I then receive "cannot call methods on varchar" - which I am assuming SQL thinks I am referring to text - rather than table names. I then tried: SELECT dbo.transaction.transactionId, user.firstName, user.lastNameFROM [transaction]INNER JOIN [user]ON dbo.transaction.userId = user.userIdORDER BY user.userId However no joy - I get the initial error message. Is someone able to point me in the right direction as to where I am going wrong? I have quite a few joins I need to do - but I thought if I could get this fixed first that would be a start.Cheers. Kev