Plz advise:

There is a table with the fields id, time.

Where time - user login time in Unix format (number of seconds since 01/01/1970). Each time a user logs in, a row is added to the table with his id and login time.

It is necessary to calculate for each user how many days he had logged in at least once.

If the ROUND values ​​(time / (24 * 60 * 60), 0) are the same for two lines, we assume that the inputs were completed on the same day.

  • do sqlfiddle for now with an example of a table and data, someone will wake up soon, it will be easier for him to understand. But in general, can the number of "visits" be considered to you during the visit by what you insert into this table? - zb '
  • the number of visits during the call is not possible to take - vedern

1 answer 1

select count(distinct ROUND(time/(24 * 60 * 60), 0)) from table where id = ?