Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query

Author  Topic 

dhinasql
Posting Yak Master

195 Posts

Posted - 2008-03-07 : 07:37:36
Hi Friends,

I have two table named as usermgmt and Usertype.

Column name for usermgmt are usertypeid,username,address
{Ex} 1 ABC IiSuite

column name for usertype are typeid,typename
{Ex} 1 Student

I want to display the username who are all in the particular usertype..

Expected Output

UserName TypeName Address
ABC Student IiSuite

Plzz help me to sort out this

dhinasql
Posting Yak Master

195 Posts

Posted - 2008-03-07 : 07:45:29
if i user the usertype is Student i have to display all the results who are in the student usertype...

Its Urgent pls
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-03-07 : 07:48:50
SELECT a.username,b.typename,a.address
FROM
usermgmt a
INNER JOIN
usertype b
ON
a.usertypeid = b.typeid
WHERE
b.typename = 'Student'

Jim
Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 2008-03-07 : 07:49:33
hi,

try this

SELECT UserName, TypeName, Address
FROM usermgmt U
INNER JOIN Usertype ut ON ut.typeid = u.usertypeid
Go to Top of Page

dhinasql
Posting Yak Master

195 Posts

Posted - 2008-03-07 : 08:49:23
Hi Ranganath,

Thank You very much, I got a solution
Once again Thanks
Go to Top of Page
   

- Advertisement -