Answer the question
In order to leave comments, you need to log in
ORDER BY .. HAVING or "complex" sorting?
I have a hat like this:
The problem is this:
linkedid is a unique number.
If Answered is in disposition, then it should be left, and No answer should be discarded.
If linkedid is one and in disposition - No answer, then we also leave
Thought on GROUP BY .. HAVING, but it doesn't even work.
Please tell me which direction to go
Answer the question
In order to leave comments, you need to log in
SELECT *,
ROW_NUMBER() OVER(PARTITION BY linkedid ORDER BY disposition) AS row_num
FROM <tablename>
WHERE row_num = 1
You can’t group telephony logs normally, there are a million different variations and the data arrives in random order often.
We need a full-fledged script with logic that processes this mess in the table and writes down some final version for each call.
As an option: JOIN on itself by linkedid with the necessary conditions for the first disposition and the second.
But if there are a lot of records, it will slow down.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question