Solved

SQL Query assistance linking between columns

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

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
>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
Comment Utility
Thank you this helps me!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now