Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | 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
 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
Flowing Fount of Yak Knowledge

2780 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  
 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.06 seconds. Powered By: Snitz Forums 2000