Last active
June 30, 2019 22:03
-
-
Save david-mart/505fdfe38d677ea9d67b788ea2858e37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT Domain from bill_items group by Domain; | |
select | |
Domain, | |
Product_Name, | |
sum(Amount) as total, | |
DATEPART(Month, Start_Date) as Month, | |
DATEPART(Year, Start_Date) as Year | |
from bill_items | |
group by | |
Domain, | |
Product_Name, | |
DATEPART(Month, Start_Date), | |
DATEPART(Year, Start_Date) | |
order by | |
Domain, | |
Year, | |
Month; | |
select | |
b.Domain, | |
a.customer_id | |
from MSCRMDB.goog.bill_items b | |
inner join MSCRMDB.crm.agreement_v a on a.customer_domain = b.Domain | |
group by b.Domain; | |
select | |
Domain | |
from MSCRMDB.goog.bill_items | |
group by Domain; | |
select | |
b.Domain, | |
a.customer_id | |
from MSCRMDB.goog.bill_items b | |
left outer join | |
MSCRMDB.crm.agreement_v a | |
on | |
a.customer_domain = b.Domain | |
group by a.customer_id, b.Domain; | |
select customer_id, customer_domain, customer_name from crm.agreement_v where customer_name '%tuilifestyle%' ESCAPE ' ';; | |
UPDATE | |
MSCRMDB.goog.bill_items | |
SET | |
MSCRMDB.goog.bill_items.customer_id = a.customer_id | |
FROM | |
MSCRMDB.goog.bill_items b | |
INNER JOIN | |
MSCRMDB.crm.agreement_v a | |
ON | |
a.customer_domain = b.Domain; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment