SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Statement Issue - Combined Rows
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

nhess80
Yak Posting Veteran

83 Posts

Posted - 08/28/2014 :  14:08:36  Show Profile  Click to see nhess80's MSN Messenger address  Reply with Quote
Currently the sql statement I have below will return these results

SysName | Port | TxRx | Power

Henning - VZW, 1, Tx, -2.97
Henning - VZW, 1, Rx, -13.93
Henning - VZW, 2, Tx, -4.99
Henning - VZW, 2, Rx, -5.72


But I am trying to get it to return the results like this and cannot figure out how


Henning - VZW, 1, TX -2.9, RX -13.93
Henning - VZW, 2, TX -4.99, RX -5.72


Any help would be great..Thanks, Nick


SELECT SysName, RowID AS Port,c.UniqueName AS TxRx, ROUND( LOG10(RawStatus /10000) * 10, 2 ) AS Power

FROM [SolarWindsOrion].[dbo].[CustomPollerStatus] d

RIGHT JOIN(

SELECT b.NodeID,b.SysName,b.CustomPollerID,b.CustomPollerAssignmentID,UniqueName
FROM [SolarWindsOrion].[dbo].[CustomPollers] c

RIGHT JOIN(


SELECT a.NodeID,a.SysName,CustomPollerID,CustomPollerAssignmentID
FROM [SolarWindsOrion].[dbo].[CustomPollerAssignment] b

RIGHT JOIN(


SELECT NodeID,SysName
FROM [SolarWindsOrion].[dbo].[Nodes] a
Where Vendor = 'Accedian'


) a

ON a.NodeID = b.NodeID
Where b.CustomPollerID IN ('CA5B0D5F-DAB6-4DC4-8F78-58715DF05F7A','C7F914E5-C590-4CE0-91DE-145EC826CD6D')

) b
ON c.CustomPollerID = b.CustomPollerID

) c
ON d.CustomPollerAssignmentID = c.CustomPollerAssignmentID

Where RawStatus <> '0' AND NodeID = '13'

Group by c.NodeID,c.SysName,c.CustomPollerID,c.CustomPollerAssignmentID,c.UniqueName,RawStatus,RowID

Order by SysName, RowID,UniqueName DESC,RawStatus

gbritton
Aged Yak Warrior

797 Posts

Posted - 08/29/2014 :  09:19:37  Show Profile  Reply with Quote
This article discusses how to do what you need, and various techniques to do it:
http://www.sqlservercentral.com/articles/T-SQL/63681/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000