I Need to Select all from Log Table and import Data when Cases
If UserGrade =1 this is Admin User and I need to select Admin Name by Log.User
If UserGrade =2 this is Teacher User and I need to select Teacher Name by Log.User
If UserGrade =3 this is Student User and I need to select student Name by Log.User
I try This
select L.[UserID],L.[UserGrade],L.[Operation],L.[OpDate],
case
when L.[UserGrade]=2 then (select teacherNAME from Teacher ,[Log] where teacherID=[Log].[UserGrade] )
when L.[UserGrade]=1 then (select [Adm_Name] from Administrator ,[Log] where [Adm_ID]=[Log].[UserGrade] )
when L.[UserGrade]=3 then (select [studentNAME] from student ,[Log] where [studentID]=[Log].[UserGrade] )
end from [Log] L ,Teacher , Administrator ,student
I Need Help ...
Aucun commentaire:
Enregistrer un commentaire