|
degraft
Starting Member
10 Posts |
Posted - 2009-03-09 : 05:48:05
|
| Hello Gurus, I have a problem. Please kindly help me out. I have these tables tbLongSigns(LongID,TypeID,CatID,Town,StreetAddress,ElectoralArea,Cost)tbShortSigns(ShortID,TypeID,CatID,Town,StreetAddress,ElectoralArea,Cost)tbApplicants(AppliID,Title,FirstName,LastName,CompanyName,PostalAddress,Tel,Fax,AccountNo,Arrears). tbSetType(TypeID,Type) ' For the LongSigns types' .tbSetShortType(TypeID,Type) 'For the ShortSigns types'. I have linked the tables appropriately. Now I wish to load a report so that all the LongSigns and ShortSigns that a particular Applicant applied for under the columns(Type,Category,Town,StreetAddress,ElectoralArea,Cost)This is the Procedure I'm using but it returns only the records of tbLongSigns:ALTER PROCEDURE [dbo].[spReceipt]@ApplicantID intASSelect DISTINCT Title + ' ' + FirstName + ' ' + LastName As 'Contact Person',CompanyName,PostalAddress,Tel,Fax,AccountNo,Arrears,(Select Cost From tbCosts Where SignType=COALESCE(T.Type,ST.Type) And Category=Cat.Category) As 'SignCost',COALESCE(L.SignID,S.SignID) As 'SignID',COALESCE(T.Type,ST.Type) As 'Type',Category,COALESCE(L.Town,S.Town) As 'Town',COALESCE(L.StreetAddress,S.StreetAddress) As 'StreetAddress',COALESCE(L.ElectoralArea,S.ElectoralArea) As 'ElectoralArea'From tbApplicants A,tbSetCategory Cat,tbSetType T,tbSetShortType ST,tbLongSigns L,tbShortSigns SWhere A.ApplicantID = @ApplicantIDAnd (A.ApplicantID = L.ApplicantID And A.ApplicantID = S.ApplicantID)And (Cat.CatID = L.CatID And Cat.CatID = S.CatID)And (T.TypeID = L.TypeID And T.TypeID = L.TypeID)RETURNPlease help me out. My boss is on my neck. Thanks so much in advance.DD |
|