Hi,

> On 2012-09-21 10:55 AM, Rich Graves wrote:
>> For the "Last Session" lookup, I don't think you need the subquery at all. 
>> It can be reduced to:
>>
>>     select 
>> CONCAT(SUBSTRING(callingstationid,1,2),':',SUBSTRING(callingstationid,3,2),':',SUBSTRING(callingstationid,5,2),':',
>>                   
>> SUBSTRING(callingstationid,7,2),':',SUBSTRING(callingstationid,9,2),':',SUBSTRING(callingstationid,11,2))
>>  AS mac,username,IF(ISNULL(acctstoptime),'connected','not connected') AS 
>> status,acctstarttime,acctstoptime,FORMAT(acctsessiontime/60,2) AS 
>> acctsessiontime,
>>                   nasipaddress,nasportid,nasporttype,acctinputoctets AS 
>> acctoutput,
>>                   acctoutputoctets AS 
>> acctinput,(acctinputoctets+acctoutputoctets) AS accttotal,
>>                   IF(ISNULL(acctstoptime),'',acctterminatecause) AS 
>> acctterminatecause
>>               FROM radacct WHERE callingstationid = ? ORDER BY acctstarttime 
>> DESC LIMIT 1;
> I think you are right about this.  That would return the most recent
> session info.  I am willing to make the change if you can confirm the
> output data is the same.
See commit 11d77e0ef2f30590083fe4bc74377f4f525c1dc7 for the fixed query.

Thanks!

-- 
Francois Gaudreault, ing. jr
[email protected]  ::  +1.514.447.4918 (x130) ::  www.inverse.ca
Inverse inc. :: Leaders behind SOGo (www.sogo.nu) and PacketFence 
(www.packetfence.org)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to