I've been trying to make a query for a while, but I can't quite figure it out. Hopefully someone from this forum can help me
The result of the query must be the sum from the different types (ivr, term, queue) from table 1 per company name (level 10) from table 1.
What I now have is a subquery in the where part. When I hard put in an ID from table 1 it works. However, with the subquery - which returns multiple lines - it doesn't work.
Can someone help me further with this?
table 1 t1
Name, ID level
company-A 1111 10
company-B 2222 10
user-A 1111 5
user-B 2222 5
user-C 3333 5
table 2 t2
t1.Name t1.id t2.count term, t2.count ivr, t.2count queue
company-A 1111 2 0 1
company-B 2222 3 1 0
SUM(type LIKE '%ivr%') AS ivr,
SUM(type LIKE '%queue%') AS queue,
SUM(type LIKE '%term%') AS term
where extended_number LIKE ('%', (SELECT id from t1 where level = 10), '%');
Thanks in advance!