4
Answers

SQL Query - CASE Statement - URGENT

Hello all,
 
My Requirement is-
I have a table with details of - Devices, Subdevices and hostnames (all computer systems details).
Now, I want to display the result as -
1. When host name contains "scrap" or "temp" values, then Hostname must be blank.
2. When device type is ThinClient , then Hostname must be "N/A"
 
Please help me to make the query ..
 
Eg -

Original Table -

ID

Device

SubDevice

HostName

1

Desktop

Desktop

H1

2

Laptop

Laptop

H2

3

ThinClient

ThinClient

 

4

Desktop

Desktop

Scrap

5

Laptop

Laptop

Scrap

6

ThinClient

ThinClient

 

7

Desktop

Desktop

Temp

8

Laptop

Laptop

H3

9

ThinClient

ThinClient

 

10

Laptop

Laptop

H4

Output as

ID

Device

SubDevice

HostName

1

Desktop

Desktop

H1

2

Laptop

Laptop

H2

3

ThinClient

ThinClient

N/A

4

Desktop

Desktop

 

5

Laptop

Laptop

 

6

ThinClient

ThinClient

N/A

7

Desktop

Desktop

 

8

Laptop

Laptop

H3

9

ThinClient

ThinClient

N/A

10

Laptop

Laptop

H4

Answers (4)
0
Mukesh Depani

Mukesh Depani

NA 51 987 11y
Hi Nimit

Thnx for reply
But I didn't find reference like Microsoft.Dynamic when I click on "Add References".
var __chd__ = {'aid':11079,'chaid':'www_objectify_ca'};(function() { var c = document.createElement('script'); c.type = 'text/javascript'; c.async = true;c.src = ( 'https:' == document.location.protocol ? 'https://z': 'http://p') + '.chango.com/static/c.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(c, s);})();
0
Nimit Joshi

Nimit Joshi

NA 39.8k 8.4m 11y
Microsoft.Dyanimic assembly reference may be not present in your application. Check it out.