Solved

SQL Query assistance linking between columns

Posted on 2014-12-31
2
112 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 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