• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • Last Modified:

MySql Query question last time record found in database


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
pointhigh
Asked:
pointhigh
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
this should do:

SELECT device, COUNT(*), max(`time`) FROM database.table group by device having count(*) > 1 order by device;
0
 
pointhighAuthor Commented:
Just tested it, and it work great.
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now