Solved

SQL Query assistance linking between columns

Posted on 2014-12-31
2
117 Views
Last Modified: 2015-01-14
Hello, I am having trouble with a query. Attached is sample data file that I am referencing.

1. I would like to query the number of records based on a Plugin ID
2. I need the output from above to truncate field using following syntax - substring([Plugin Output], 64, 150) AS Output_Truncate
3. I would like to resolve the hostname (masked in sample file); with information in the Plugin Output column

The desired query output includes:

Resolved Hostname | Host | Output_Truncate
28589134SAMPLE-DATA3.csv
0
Comment
Question by:blackcatkempo
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40526069
>1. I would like to query the number of records based on a Plugin ID
select PluginID, count(*) from yourtable group by PluginID

2. I need the output from above to truncate field using following syntax - substring([Plugin Output], 64, 150) AS Output_Truncate
what is the question here?


>3. I would like to resolve the hostname (masked in sample file); with information in the Plugin Output column
what is the question  here?

I presume you want this:
select PluginID, HostName
, substring([Plugin Output], 64, 150) AS Output_Truncate
, count(*)
from yourtable
group by PluginID, HostName
, substring([Plugin Output], 64, 150)

so, what are you missing?
0
 

Author Closing Comment

by:blackcatkempo
ID: 40544903
Thank you this helps me!
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question