Solved

MySql Query question last time record found in database

Posted on 2011-09-05
2
322 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 142

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

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.

Join & Write a Comment

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

12 Experts available now in Live!

Get 1:1 Help Now