Improved SQL for postgresql.
This commit is contained in:
parent
f19bc39ddf
commit
e6540720a3
1 changed files with 2 additions and 2 deletions
|
@ -48,12 +48,12 @@ returns
|
|||
result = Cti::CallerId.where(
|
||||
caller_id: caller_id,
|
||||
level: 'known',
|
||||
).group(:user_id).order('id DESC').limit(20)
|
||||
).group(:user_id, :id).order(id: 'DESC').limit(20)
|
||||
if !result[0]
|
||||
result = Cti::CallerId.where(
|
||||
caller_id: caller_id,
|
||||
level: 'maybe',
|
||||
).group(:user_id).order('id DESC').limit(20)
|
||||
).group(:user_id, :id).order(id: 'DESC').limit(20)
|
||||
end
|
||||
if !result[0]
|
||||
result = Cti::CallerId.where(
|
||||
|
|
Loading…
Reference in a new issue