?
Solved

MySql Query question last time record found in database

Posted on 2011-09-05
2
Medium Priority
?
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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