Solved

MySql Query question last time record found in database

Posted on 2011-09-05
2
331 Views
Last Modified: 2012-05-12

I have this query:
SELECT device, COUNT(*) FROM database.table group by device having count(*) > 1 order by device;

What I need to do is add a column that shows the last time the device connected to the database.

The table is structured like:
ID, device(string), data1(int),data2(int), time(timestamp), data3(int),data4(int)
Thanks
0
Comment
Question by:pointhigh
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 36485096
this should do:

SELECT device, COUNT(*), max(`time`) FROM database.table group by device having count(*) > 1 order by device;
0
 

Author Closing Comment

by:pointhigh
ID: 36485486
Just tested it, and it work great.
Thanks
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CheckListBox usage 3 72
Help With Query That Causes "WARNING: MySQL server has gone away" Error 3 35
mysql date time 14 38
Uploading a CSV Data Import via PHP & MySql 3 36
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

820 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