Click to See Complete Forum and Search --> : Prob in Stored Procedure(MS SQL)


Gopinath
06-20-2003, 08:59 AM
CREATE Proc test_m_Cros_Depa_Assi_Cour_List
as
Begin
Set NoCount on
Select distinct T1.Cros_Depa_Assi_Id,T1.Cros_Depa_Assi_Name,
T2.Cour_Id1, T3.Cour_Numb + ' - ' + T3.Cour_Name as 'Cour_Name1',
Coalesce(T2.Cour_Id2,'') as 'Cour_Id2' ,Coalesce(T4.Cour_Numb + ' - ' + T4.Cour_Name,'') as 'Cour_Name2'
from m_Cros_Depa_Assi T1, d_Cros_Depa_Educ_Assi T2,d_Cour T3,d_Cour T4
where
T1.Cros_Depa_Assi_Id = T2.Cros_Depa_Assi_Id and
T2.Cour_Id1 = T3.Cour_Id and
T2.Cour_Id2 *= T4.Cour_Id
Order by T1.Cros_Depa_Assi_Name, T3.Cour_Numb + ' - ' + T3.Cour_Name
End

Cros_Depa_Assi_Name any Name like 'Assignment1'
Suppose the Cour_Numb is 7777 and 3333
Cour_Name is yyyyy and aaaaa

result part:
Assignment1 7777 - yyyyy
Assignment1 3333 - aaaaa

But i want
Assignment1 3333 - aaaaa
Assignment1 7777 - yyyyy