I want some help in writing a typical SQL query in Erlang. I just want to prevent logging the offline message based on this query.
Want to put this query at start of this function.
store_offline_msg(Host, {User, _Server}, Msgs, Len, MaxOfflineMsgs, odbc) ->
Count = if MaxOfflineMsgs =/= infinity ->
Len + count_offline_messages(User, Host);
true -> 0
end,
if Count > MaxOfflineMsgs -> discard_warn_sender(Msgs);
Mysql Table
ID | user | touser | starttime | end
586 | my_gmail.com | touser_gmail.com | 2014-10-29 14:03:16 | 60
Query I need is to check:
if 'user' and 'touser' have a record in this table, and current time comes in between stattime and startime + end (60 seconds)
Please help me in this, I appreciate it.