hello everyone
i am not sure if this is the right place to ask this question; if its not , then i sincerely apolgise.
i am trying to use two aggregate functions ( at the same time) on an SQL query; i am not sure if this is possible.
i will explain;
i have a loggin script that records ,in UNIX time stamp, the exact time a member logs into the site. this is stored in a MYSQL table called 'loggin_times. in a column called login_time.
i now wish to receive three things from this table
1. the number of loggins the user has made. COUNT ( login_time)numberlogins
2. the last time occassion when the user logged in. MAX ( login_time ) lastlogin
3. the exact time that the user logged in. FROM_UNIXTIME( login_time )time
In my SQL query i obviously first have to do a 'GROUP BY' of the loggin times, and then use the aggregate function listed above. i am clear on this point.
my question relates to part 3 of the above list, i.e obtaining the exact time of the last login.
to do this i need to accesss the retrieved data held within the
MAX ( login_time ) lastlogin
i tried to do the following doubling up of two functions but it did not work
FROM_UNIXTIME (lastlogin, '%D %b %y' ( MAX ( login_time )lastlogin )sent_date ,
Does anyone have an idea whether the two functions can indeed be combined or is there another way to do it.
thank you for your kind assistance
warm regards
Andreea