Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

How to generate single row output

$
0
0

Good day! I would like to ask how can i generate an output on a single line. Here is my code:

Select Wo.wonum as 'Work Order Number',
WO.assetnum as 'Asset Number',
WO.reportdate as 'Creation Date & Time',
(Select WOS.changedate
 where WO.wonum = WOS.wonum and WOS.status = 'Close') as 'Resolve Date & Time',
A.serialnum as 'System Number',
WO.zzparent as 'Vehicle/Container Number',
WO.status as 'STATUS',
WO.zzcity as 'CITY',
(Select FC.description
   where FC.failurecode = FR.failurecode and FR.type = 'Problem') as 'Problem Description',
(SELECT FC.description
   where FC.failurecode = FR.failurecode and FR.type = 'Cause') as 'Cause Description'

From workorder as WO join asset as A on a.assetnum = WO.assetnum

Join failurereport as FR on FR.wonum = WO.wonum

Join wostatus as WOS on WOS.wonum = WO.wonum

Join failurecode as FC on FR.failurecode = FC.failurecode

where WO.assetnum = A.assetnum and WOS.status ='Close' and WOS.wonum = '1499'

The current output of the script is it showing 2 rows set result for Problem and Cause description.

Now, what i want is to have it in single line. I want the problem description to be align to cause description and only have one single row result.


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>