Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Unanswered: Splitting Data From One Column into Two

    Running SQL 2005
    Current Query is as follows:

    SELECT
    vPerf.DateTime,
    vPerf.SampleCount,
    vPerf.AverageValue,
    vPerf.MinValue,
    vPerf.MaxValue,
    vPerf.StandardDeviation,
    vPerformanceRuleInstance.InstanceName,
    vManagedEntity.Path,
    vPerformanceRule.ObjectName,
    vPerformanceRule.CounterName
    FROM
    Perf.vPerfHourly AS vPerf INNER JOIN
    vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRo wId = vPerf.PerformanceRuleInstanceRowId INNER JOIN
    vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
    vPerformanceRule ON vPerformanceRuleInstance****leRowId = vPerformanceRule****leRowId
    WHERE
    (vPerf.DateTime >= '7/10/2012') AND
    (vPerf.DateTime < '7/11/2012') AND
    (vPerformanceRule.ObjectName = 'Logicaldisk')
    ORDER BY vPerformanceRule.CounterName

    This query was working well because I used to only be interested in one counter that was returned in the column, which was 'Free Megabytes'
    However, I now have additional data that shows up as 'Total Disk Space'

    Ideally, the query would return the total disk space next to the free megabytes on the same row for the same disk drive. Here is a couple rows of sample output:

    AverageValue InstanceName ObjectName CounterName
    44549 C: LogicalDisk Free Megabytes
    44548 C: LogicalDisk Free Megabytes
    69452 C: LogicalDisk Total Disk Space
    69452 C: LogicalDisk Total Disk Space

    This is the ideal format, the average value column goes away:

    InstanceName ObjectName Free Megabytes Total Disk SpaceC: LogicalDisk 44549 69452

  2. #2
    Join Date
    Apr 2004
    Location
    Arizona
    Posts
    75
    I think if you just simply add the date to your order by might do the trick...

    ORDER BY vPerf.DateTime,vPerformanceRule.CounterName

    But the out put will be one on top of each other. If you want to do them side by side I think you are going to have to do Sub-Selects in your select statement which can be messy.

Posting Permissions

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