Solved

SQL Query assistance linking between columns

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert SP in a format for debugging 7 30
Minus first query 1 36
SQL compatability in SQL 2016 2 31
Linking a DMV to a database id/sql text in SQL server 2008 8 46
I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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

11 Experts available now in Live!

Get 1:1 Help Now