Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Unanswered: How can i get the result like this avg=3.5

    Hi,
    My Result is like this avg=3.568799999 but my requriment is
    avg=3.5 like
    Which fiunctoin is usefull for me

  2. #2
    Join Date
    Aug 2009
    Posts
    37
    Hi nagaraju

    use this

    Select Str(1212.2323, 12, 2)

  3. #3
    Join Date
    Apr 2010
    Location
    Charlotte, NC
    Posts
    11
    You can also cast your result to a DECIMAL(9,1) that would round it down to one decimal place. See: http://msdn.microsoft.com/en-us/libr...SQL.80%29.aspx for more information.

    CAST(DECIMAL(9,1), averageResult)
    ---
    Shannon Lowder
    Database Engineer
    http://toyboxcreations.net

  4. #4
    Join Date
    Apr 2010
    Posts
    3

    Leaves

    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.
    Last edited by nagarajukatakam; 04-20-10 at 08:56.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Does this have anything to do with your original question? If not then please start a new thread.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Also, just to expand on the first question - it looks like you have used a float\ real datatype where you probably would have been better with a Decimal (fixed precision ).

Posting Permissions

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