Results 1 to 2 of 2

Thread: Leavestats

  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Unanswered: Leavestats

    SELECT lve.TypeOfLeave,
    (SELECT L.LookUpValue
    FROM dbo.CMSLookUp L
    WHERE L.LookUpId=lve.TypeOfLeave)
    AS LeaveType,
    lt.NumberofLeaves,sod.StaffId,spd.StaffCode,
    sod.Department,sod.Designation,
    sod.DateOfJoining,spd.FirstName+''+spd.LAStName
    AS StaffName
    FROM dbo.CMSStaffOfficialDetails sod
    INNER JOIN
    dbo.CMSStaffPersonalDetails spd
    ON sod.StaffId=spd.StaffId
    INNER JOIN
    dbo.CMSLeaves LVE
    ON LVE.ReferenceID=sod.StaffId
    INNER JOIN
    dbo.CMSLeaveTypes LT
    ON LT.TypeofLeave=LVE.TypeOfLeave

    WHERE (sod.Department=@Dept OR @Dept IS NULL)
    AND
    (@staffName IS NULL OR (spd.FirstName+' '+spd.LAStName)
    LIKE'%'+@staffName+'%')
    ORDER BY
    sod.DateOfJoining DESC
    I want result like below
    FirstName: naga Department: --Select--
    HR
    Marketing
    Finance

    When i click searach butten with the conditon of firstname and department

    result is like bellow:

    Staff Code: Staff201047#92 Designation: principal

    Date of Joining: 08/04/2010 Department: Finance

    First Name: naga



    Type of Leave | Total No. of Leaves | Availed Leaves | Availableleavs Leaves

    Casual 24 ? ?



    This is Holidays table bellow


    HolidaysId,
    YearId,
    HolidayDate ,
    HolidayName,
    HolidayDesc,
    CreatedBy,
    Dreateddate,
    Modifiedby,
    MidifiedDate
    i need a query for Availed leaves and Available leaves also
    using above stored procedure.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'm afraid your question makes no sense to me.

    Please provide the DDL for your table, some sample data and the desired output.
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •