Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

SQL querry need help

$
0
0

Hi,

i am very new in using SQL and i am still learning.

I need help with a SQL querry.

Here is my problem.

Table1

ResourceID, Computername

101, Computer1

201, Computer2

301, Computer3

....

Table 2

ResourceID, Software, Version

101, Java, 8

101, Adobe

101, Word

201, Java, 7

201, Adobe

301, Word

Output should look like that:

101, Computer1, Java, 8

201, Computer2, Java, 7

301, Computer3, Java, not installed

I am getting:

101, Computer1, Java, 8

101, Computer1, Java, not installed

201, Computer2, Java, 7

201, Computer2, Java, notinstalled

301, Computer3, Java, not installed

Querry I am using:

SELECT DISTINCT Table1.Computername, Table1.ResourceID, Table2.Software,

CASE	WHEN Table2.Software LIKE '%JDK%' THEN 'Java'
		WHEN Table2.Software NOT LIKE '%JAVA%' THEN 'notinstalled'
END AS [Java]



FROM   v_R_System LEFT JOIN
                         Table2 ON Table1.ResourceID = Table2.ResourceID





Viewing all articles
Browse latest Browse all 7129

Trending Articles



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