SQL Request Newbe

Hi,
sorry for wasting your time with that stupid question but what the hack is wrong with that:

Select role_name
From role
Inner Join account on sessionmap.account_ID = account.account_ID AND
Inner Join role on account.role_ID=role.role_ID
Where sessionmap_ID=1

You can't have an "AND" between joins:

Select role_name
From role
Inner Join account on sessionmap.account_ID = account.account_ID --<<--removed AND from here
Inner Join role on account.role_ID=role.role_ID
Where sessionmap_ID=1

I'm assuming you have a table/view named "role".

1 Like

You have other issues as well. You're referenced the role table twice, and you've used the alias "sessionmap" but you don't have any table that corresponds to that.

Perhaps you need something closer to:

Select role_name
From sessionmap
Inner Join account on sessionmap.account_ID = account.account_ID
Inner Join role on account.role_ID=role.role_ID
Where sessionmap_ID=1

1 Like

Thanksgiving. Works fine now!

What @ScottPletcher said :slight_smile:

Also, you're referencing an alias called sessionmap, but it doesn't seem you have an alias with that name. What also puzzles me is, you're selfjoining the role table with the same field; that seems redundant to me, at least in the query you showed (but maybe you have simplified the query, so is makes sense anyway?!?).

1 Like

I input dummy data
The answer should be
"role_Name: user"
The output atm is: "role_Name: "

Ups im stupid. I had to reinsert the table because i didnt switch swedish to german
and my dummydata in sessionID disappeared.

Everything works ^^