• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

SQL Query assistance linking between columns

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
blackcatkempo
Asked:
blackcatkempo
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>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
 
blackcatkempoAuthor Commented:
Thank you this helps me!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now