question

AlexKlap avatar image
AlexKlap asked

Only Required Column Need to Display

Please help me to get this. Input Part_Number Part_Type Description_1 Value1 Description_2 Value2 Description_3 Value3 EDG38305 Gauge Compatibility CTS Location Dashboard Head Light DISC i need output like this. OUTPUT > Part_Number,Part_Type,Description_1,Value1, > Description_2,Value2,Description_3 > Value3 > > EDG38305,Gauge, '','', '','',Head Light,DISC only value column which contain DISC with respective description that is if value 3 is DISC THEN OUTPUT SHOW DESCRIPTION 3 AND VALUE 3 AND REMAINING FEILD REMAIN BLANK Thank You All
sql
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AlexKlap avatar image AlexKlap commented ·
if its possible like this > EDG38305,Gauge, Head Light,DISC works fine for me. i.e Description 3 with value 3 because value 3 contain word called disc.
0 Likes 0 ·

1 Answer

·
Squirrel avatar image
Squirrel answered
SELECT Part_Number + ',' + Part_Type + ',' + case when Value3 = 'DISC' then '' else Description_1 end + ',' + case when Value3 = 'DISC' then '' else Value1 end + ',' + case when Value3 = 'DISC' then '' else Description_2 end + ',' + case when Value3 = 'DISC' then '' else Value2 end + ',' + Description_3 + ',' + Value3
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AlexKlap avatar image AlexKlap commented ·
Thanks Squirrel, but unfortunately my requirement is different. i need output with DISC value in any of the value column which may either column called as value1 or column called as value2 or any of the such column. and if Disc is found in any of the value column it must be in output with its associated description column. that is if column value 25 contain Disc and column Description contain Round, then output should be IN Value feild as "DISC" AND Round in Description feild
0 Likes 0 ·
Squirrel avatar image Squirrel commented ·
just change the CASE WHEN condition accordingly to your need.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.