April 06, 2007

Represent Rows as Single Column in DB2

select ifnull(virtual.Q1, '') || ifnull(virtual.Q2, '') || ifnull(virtual.Q3, '') || ifnull(virtual.Q4, '') || ifnull(virtual.Q5, '') 
|| ifnull(virtual.Q6, '') || ifnull(virtual.Q7, '') || ifnull(virtual.Q8, '') || ifnull(virtual.Q9, '')as sentence from (

SELECT hex(sst.sst_scs_tk), 
       MAX(CASE WHEN sst.sst_ent_seq_nu = 1
           THEN sst.sst_tx END) AS Q1,
       MAX(CASE WHEN sst.sst_ent_seq_nu = 2
           THEN sst.sst_tx END) AS Q2,
       MAX(CASE WHEN sst.sst_ent_seq_nu = 3
           THEN sst.sst_tx END) AS Q3,
       MAX(CASE WHEN sst.sst_ent_seq_nu = 4
           THEN sst.sst_tx END) AS Q4,
 MAX(CASE WHEN sst.sst_ent_seq_nu = 5
           THEN sst.sst_tx END) AS Q5,
 MAX(CASE WHEN sst.sst_ent_seq_nu = 6
           THEN sst.sst_tx END) AS Q6,
 MAX(CASE WHEN sst.sst_ent_seq_nu = 7
           THEN sst.sst_tx END) AS Q7,
 MAX(CASE WHEN sst.sst_ent_seq_nu = 8
           THEN sst.sst_tx END) AS Q8,
 MAX(CASE WHEN sst.sst_ent_seq_nu = 9
           THEN sst.sst_tx END) AS Q9
FROM sst
where sst.sst_scs_tk in (
 select spa.SPA_SCS_TK from spa where spa_per_tk = x'AAEB98F45CA740FF'  
)
GROUP BY sst.sst_scs_tk
) as virtual

2 comments:

Mossy Mom said...

Hi,

I'm glad you like my blog.

You could go down the Upper South Fork Skokomish Trail and hike about 2 miles in to a campsite on the river. I just got home from climbing Mount Adams so I'm too tired to think of much else right now.

Take Care
Mossy Mom

Anonymous said...

Read all the related Posts:


Basic of VBScript Language for QTP

Introduction to QTP (QuickTest Professional) Part2

Introduction to QTP (QuickTest Professional) Part3

Introduction to QTP (QuickTest Professional) Part4

Basic of VBScript Language for QTP


Read all the related Posts:

64 Software Manual Testing Interview Questions

Answers To Common Job Interview Questions

Behavioral Questions In Interviews

Questions to Ask at an Interview

Competency based Interview Questions