Show campaigns that a phone number appears in

Multi tool use
Multi tool use
The name of the picture


Show campaigns that a phone number appears in



I'm trying to get a report done within SQL that shows each sales campaign that a phone number appears in.



The desired result:


Phonenumber | Area Code | Campaign 1 | Campaign 2 (if applicable) etc...



I have the following code:


with cids as (
select distinct
a.outbound_cid as [CID]
, a.areacode as [AreaCode]
, a.campaign_id as [Campaign]
from vicislave...vicidial_campaign_cid_areacodes a
join LDS_SALES_CAMPAIGNS b on a.campaign_id = b.campaign_id
)

select * from cids
order by cid



Which gives me (data example):
enter image description here



In this example, I would get


2012444340 201 ZEPTR ZEACC ZBEASTC ZEPRR InBnd2 ZEPSC ZEJCC ZEJSC ZEPCC ZEASC



I've not worked with cross-tabbing before, but it appears to be something that may work, but I have not been able to make it work like I can. Obviously, I can do the MIN and MAX of each of these, but I don't know of a way to get the data into the one row, even using things like Excel, without manually doing it, which with 1110 results with these, I don't really have time to do it.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

6 eWczNbu1gAxzl,5XKrBMtQ2
3M5nhEuKSW5QN TkcS,D5FU306El16aKi5NlXje9 xgFYKAJwsj IRz1,WVtOdIeYAOfp,FLt G1i9RL

Popular posts from this blog

Keycloak server returning user_not_found error when user is already imported with LDAP

PHP parse/syntax errors; and how to solve them?

Using generate_series in ecto and passing a value