Solved

select statements

Posted on 2011-03-20
2
250 Views
Last Modified: 2012-05-11
From a table that contains user logs i need to get info from two columns: contain client_id and log_description.

The user_id column is a 4 word column.
The log description column contains alot of user activity listed in separate rows (including: time logged on, server connected to, IP address, connect/disconnect, action carried out, etc)

how can i find out users (userID column) that have connected and disconnected (log_description column) more than 10 times?

i believe i need to filter the log_description column to search for keywords (%connect% / %disconnect%) and associate that with the userid column. then display results as # of connections.

Please advice.
0
Comment
Question by:B0b_shiska
2 Comments
 
LVL 11

Accepted Solution

by:
JoeNuvo earned 500 total points
ID: 35177745
SELECT userID 
FROM UserLog with (nolock)
WHERE log_description like '%connect%' 
-- disconnect already part of %connect%, do we don't need to mention it
GROUP BY userID
HAVING COUNT(*) > 10

Open in new window

0
 
LVL 32

Expert Comment

by:awking00
ID: 35182806
Can you provide some sample data and the expected output?
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query 26 66
SQL Help 27 48
sql server concatenate fields 10 36
Script to backup a Database Dayli on SQL Server Express 3 11
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

825 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