On 01/06/16 10:42, Aleš Šturm wrote:

Hello,

 

yes, if the priority is the same, records should be ordered by received_time. Acting in this way, when “presentity” table has more than one record of the same user with equal priority, to watcher would be send Notify message with last received status.

 

SQL like:

select * from presentity where username=X and priority=Y order by received_time desc;

 


Well, the priority is not known in advance, query is like:

select ... from presentity by matching the user and event, ordering either by receive_time when retrieve_order=0 or by priority if retrieve_order=1.

Here it looks like order by has to be a combination of the two columns.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com - http://www.kamailio.org
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda