Sql issue..
-
I have 2 tables in my data base.. 1. User_Group table 2. Function_Group table Example: Function_Group table :
Groupid Applicationid Functionid
LCUser1 LCDocMgmt LC01
LCUser2 LCDocMgmt LC02
LCUser1 LCDocMgmt LC03
LCUser3 LCDocMgmt LC04
LCUser3 LCDocMgmt LC05
LCUser2 LCDocMgmt LC06
LCUser2 LCDocMgmt LC08
LCUser1 LCDocMgmt LC09User_Group table:
Userid Groupid
900410 LCUser1
900846 LCUser1
900411 LCUser3Now i use the following query to retrieve the Groupid for a particular Userid : Select ug.groupid from User_Group ug, Function_Group fg where fg.ApplicationID='LCDocMgmt' and fg.GroupID = ug.GroupID and ug.UserID='900846' The result that i get on executing the above query is:
groupid
LCUser1
LCUser1
LCUser1Actually i Dont require repetition of records. If there is 2 distinct records i just want the 2 distinct records without repetition.. can any one plz help me.. Thanx in advance.... Regards, Tash
-
I have 2 tables in my data base.. 1. User_Group table 2. Function_Group table Example: Function_Group table :
Groupid Applicationid Functionid
LCUser1 LCDocMgmt LC01
LCUser2 LCDocMgmt LC02
LCUser1 LCDocMgmt LC03
LCUser3 LCDocMgmt LC04
LCUser3 LCDocMgmt LC05
LCUser2 LCDocMgmt LC06
LCUser2 LCDocMgmt LC08
LCUser1 LCDocMgmt LC09User_Group table:
Userid Groupid
900410 LCUser1
900846 LCUser1
900411 LCUser3Now i use the following query to retrieve the Groupid for a particular Userid : Select ug.groupid from User_Group ug, Function_Group fg where fg.ApplicationID='LCDocMgmt' and fg.GroupID = ug.GroupID and ug.UserID='900846' The result that i get on executing the above query is:
groupid
LCUser1
LCUser1
LCUser1Actually i Dont require repetition of records. If there is 2 distinct records i just want the 2 distinct records without repetition.. can any one plz help me.. Thanx in advance.... Regards, Tash
-
<> wrote:
distinct records
You answered your own question. Select DISTINCT ug.groupid from User_Group ug, Function_Group fg where fg.ApplicationID='LCDocMgmt' and fg.GroupID = ug.GroupID and ug.UserID='900846'
-
Thanx alot... That was really a Dumb question from my side i knew that... Anyways a million thanx.. Regards, Tash