Re: SQL statement with 2 tables
From: Roji. P. Thomas (lazydragon_at_nowhere.com)
Date: 02/18/04
- Next message: Senen: "Create SQL statements based on table fields values"
- Previous message: harsh: "TRANSACTION ERROR"
- In reply to: Tom: "SQL statement with 2 tables"
- Next in thread: David Portas: "Re: SQL statement with 2 tables"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 18 Feb 2004 12:12:01 +0530
SELECT
U.UserId, U.RoleId, R.RoleName
FROM Users
INNER JOIN Roles
ON
U.RoleID = R.RoleId
-- Roji. P. Thomas SQL Server Programmer "Tom" <kerocow@yahoo.com> wrote in message news:5B2AC0B0-C67D-4D7F-9AAB-093F0487EF55@microsoft.com... > Hi, > > I have a users and a role tables in a DB. > > Users > id int > roleid int > username nvarchar > > Role > id int > rolename nvarchar > > I want to select userid, rolename, username from the above 2 tables. > > Select u.id, u.roleid, u.username from Users u can list the roleid only. But, I want to show the rolename. > > How should the SQL be? > > Thanks for help > > Tom
- Next message: Senen: "Create SQL statements based on table fields values"
- Previous message: harsh: "TRANSACTION ERROR"
- In reply to: Tom: "SQL statement with 2 tables"
- Next in thread: David Portas: "Re: SQL statement with 2 tables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|