Having trouble with a sql server 2012 query
- or -
Post a project like this2679
$50
- Posted:
- Proposals: 10
- Remote
- #1380516
- PRE-FUNDED
- Awarded
Consulting Partner for Angular, DevOps, System/Support, Quality Assurance, Azure, ETL/BI, SQL DBA
Ahmedabad
4225337625011089847835251625011173051146453124534413980941441870
Description
Experience Level: Intermediate
Estimated project duration: 1 day or less
here is the query:
select SB.[Subscriber Key], max(approved_date) last_sale
from BI_DW.dbo.vfact_RESULT_APPROVED_DATE (NOLOCK) FRL
JOIN LEAD_REPORTING..REPORTED_LEAD RL ON (FRL.REPORTED_LEAD_SRC_NUM = RL.reported_lead_id)
JOIN dbOLTP..tbl_cust_lead CL ON (CL.LEAD_ID = RL.CustLeadId)
JOIN dbOLTP..tbl_cust_customer CC ON (CL.customer_id = CC.customer_id)
JOIN [BI_Staging].[dbo].[SnakeBite_Email_Data] SB ON (SB.[Subscriber Key] = CC.subscriber_key)
where SB.timestamp_id >= '2016-11-25' and SB.[Subscriber Key] in ('0_5H9uCn9Y_MFgAR6HcmNFEDyUM')
group by SB.[Subscriber Key]
--------------------------------
so essentially its supposed to look up subscriber key '0_5H9uCn9Y_MFgAR6HcmNFEDyUM' to see if there are any sales, I have about 48k rows of those, so the query will just take forever.
i created a table [BI_SANDBOX].[dbo].[sandbox.subscriberkeyv2] that has all those keys to query against, however Im not great with table joins (or sql for that matter)
can you write the query and join the new table i created? (so the new table is queried that has all the subscriber keys)
select SB.[Subscriber Key], max(approved_date) last_sale
from BI_DW.dbo.vfact_RESULT_APPROVED_DATE (NOLOCK) FRL
JOIN LEAD_REPORTING..REPORTED_LEAD RL ON (FRL.REPORTED_LEAD_SRC_NUM = RL.reported_lead_id)
JOIN dbOLTP..tbl_cust_lead CL ON (CL.LEAD_ID = RL.CustLeadId)
JOIN dbOLTP..tbl_cust_customer CC ON (CL.customer_id = CC.customer_id)
JOIN [BI_Staging].[dbo].[SnakeBite_Email_Data] SB ON (SB.[Subscriber Key] = CC.subscriber_key)
where SB.timestamp_id >= '2016-11-25' and SB.[Subscriber Key] in ('0_5H9uCn9Y_MFgAR6HcmNFEDyUM')
group by SB.[Subscriber Key]
--------------------------------
so essentially its supposed to look up subscriber key '0_5H9uCn9Y_MFgAR6HcmNFEDyUM' to see if there are any sales, I have about 48k rows of those, so the query will just take forever.
i created a table [BI_SANDBOX].[dbo].[sandbox.subscriberkeyv2] that has all those keys to query against, however Im not great with table joins (or sql for that matter)
can you write the query and join the new table i created? (so the new table is queried that has all the subscriber keys)
David S.
100% (2)Projects Completed
7
Freelancers worked with
3
Projects awarded
14%
Last project
13 Mar 2017
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Hi,
Is this job still open ?
Kindly advice me, are you available for quick discussion ?
Best Regards,
Bals.
250655
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies