text 戴尔看起来像DUNS SQL

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 戴尔看起来像DUNS SQL相关的知识,希望对你有一定的参考价值。

--input file stats / DUNS Matches
SELECT COUNT(DISTINCT DUNSNumber) as DUNS, COUNT(DISTINCT url_match) as 'Unique URLs'
from fulfillment.dbo.orderrequestdetail ord 
where orderrequestid = 10659

--Match stats Summary / Total technology installs
SELECT COUNT(DISTINCT DUNSNumber) as DUNS, COUNT(DISTINCT url_match) as 'Unique URLs', COUNT(*) as 'Installs'
from fulfillment.dbo.orderrequestdetail ord 
join fulfillment.dbo.ph_loc_duns_core u on ord.DUNSNumber = u.dnb_duns_nbr
where orderrequestid = 10659

--Input locations that HG does not track any techs for
SELECT [DUNSNumber],ord.[Company],ord.[Address1],ord.[City],ord.[State],ord.[Zip], ord.url_match as URL, dd.dnb_out_bus_flag, dd.dnb_class_code, dd.dnb_sales_volume_us, dd.dnb_emp_here, dd.dnb_emp_total
from fulfillment.dbo.orderrequestdetail ord 
LEFT join fulfillment.dbo.ph_loc_duns_core u on ord.DUNSNumber = u.dnb_duns_nbr
LEFT JOIN [Fulfillment].[dbo].[DemoDUNS] dd ON ord.dunsnumber = dd.dnb_duns_nbr
where orderrequestid = 10659 AND u.hit_id IS NULL

--Input locations that HG does not track any techs for at the DUNS, but does have techs tracked at the URL
SELECT [DUNSNumber],ord.[Company],ord.[Address1],ord.[City],ord.[State],ord.[Zip], ord.url_match as URL, dd.dnb_out_bus_flag, dd.dnb_class_code, dd.dnb_sales_volume_us, dd.dnb_emp_here, dd.dnb_emp_total
from fulfillment.dbo.orderrequestdetail ord 
LEFT join fulfillment.dbo.ph_loc_duns_core u on ord.DUNSNumber = u.dnb_duns_nbr
LEFT JOIN [Fulfillment].[dbo].[DemoDUNS] dd ON ord.dunsnumber = dd.dnb_duns_nbr
JOIN [Fulfillment].[dbo].[ph_url_global_all] ph ON ord.url_match = ph.url
where orderrequestid = 10659 AND u.hit_id IS NULL

--product breakdown matched to DUNS
SELECT ord.[DUNSNumber],ord.[Company],ord.[Address1],ord.[City],ord.[State],ord.[Zip]
,[url_match] as URL,product_id as ProductID, Product, Vendor, category_parent as 'Category Parent', category as Category, isnull(Attribute,'') Attributes, count(*) as Installs
from fulfillment.dbo.orderrequestdetail ord 
join fulfillment.dbo.ph_loc_duns_core u on ord.[DUNSNumber] = u.dnb_duns_nbr
where orderrequestid = 10659 
Group BY product_id, product, vendor, category_parent, category, Attribute, 
ORDER BY COUNT(*) DESC

--Full tech stack of prospects
SELECT [DUNSNumber],ord.[Company],ord.[Address1],ord.[City],ord.[State],ord.[Zip],isnull([url_match],'') as URL,product_id as ProductID, Product, Vendor, date_first_verified 'Date First Verified',
date_last_verified as 'Date Last Verified', Intensity, category_parent as 'Category Parent', category as Category, isnull(Attribute,'') Attributes
from fulfillment.dbo.orderrequestdetail ord 
join fulfillment.dbo.ph_loc_duns_core u on ord.DUNSNumber = u.dnb_duns_nbr
where orderrequestid = 10659 
ORDER BY ord.DUNSNumber, vendor, product

--Dell products in use at Company when matching on URL
SELECT [DUNSNumber],ord.[Company],ord.[Address1],ord.[City],ord.[State],ord.[Zip],isnull([url_match],'') as URL,u.Company, u.City, u.State, u.Country,  product_id as ProductID, Product, Vendor, date_first_verified 'Date First Verified',
date_last_verified as 'Date Last Verified', Intensity, category_parent as 'Category Parent', category as Category, isnull(Attribute,'') Attributes
from fulfillment.dbo.orderrequestdetail ord 
join fulfillment.dbo.ph_url_location_all u on ord.url_match = u.url
where orderrequestid = 10659 AND vendor_id IN (132)
ORDER BY ord.DUNSNumber, vendor, product



--product breakdown for companies that use Dell Servers
SELECT product_id as ProductID, Product, Vendor, category_parent as 'Category Parent', category as Category, isnull(Attribute,'') Attributes, count(*) as Installs
from fulfillment.dbo.ph_loc_duns_core u
where dnb_duns_nbr IN (SELECT DISTINCT dnb_duns_nbr FROM fulfillment.dbo.ph_loc_duns_core WHERE vendor_id IN  (132, 145) AND category_id = 59)
Group BY product_id, product, vendor, category_parent, category, Attribute
ORDER BY COUNT(*) DESC


--companies that do not use dell servers but do have target products
SELECT dnb_duns_nbr, count(*) as Installs
from fulfillment.dbo.ph_loc_duns_core u
where dnb_duns_nbr NOT IN (SELECT DISTINCT dnb_duns_nbr FROM fulfillment.dbo.ph_loc_duns_core WHERE vendor_id IN  (132, 145) AND category_id = 59)
AND product_id IN (1319,10481,862,704,1041,12673,717,4663,4713,593,12671,737,993,4558,616,1347,6453,12476,12670,6496)
AND country = 'Canada'
Group BY dnb_duns_nbr
ORDER BY COUNT(*) DESC

--sample company tech stack to target based on 'companies that do not use dell servers but do have target products'
SELECT TOP (1000) *
  FROM [Fulfillment].[dbo].[ph_loc_duns_core]
  where dnb_duns_nbr = '242997609'
  order by vendor, product

  
--Dell Servers Count off the URL table
SELECT product_id as ProductID,
Product, Vendor,
category_parent as 'Category Parent',
category as Category,
isnull(Attribute,'') Attributes,
count(*) as Installs
from fulfillment.[dbo].[ph_url_global_all] 
WHERE vendor_id IN  (132, 145) AND category_id = 59
Group BY product_id, product, vendor, category_parent, category, Attribute
ORDER BY COUNT(*) DESC

--ALL Servers Count off the URL table

SELECT company as 'company'
,Date_first_verified as 'DFV'
,Date_last_verified as 'DLV'
,intensity as 'intensity'
,revenue_range as 'revenue size'
,employees_range as 'employee size'
,top_level_industry as 'Industry'
,product as 'Product'
from fulfillment.[dbo].[ph_url_global_all] 
WHERE vendor_id IN (132, 145) AND category_id = 59
ORDER BY intensity DESC


--companies not in Client DNB prospect match file do have same target products
SELECT  --dnb_duns_nbr, count(*) as Installs
url
,Company as 'Company'
,dnb_duns_nbr as 'DUNS #'
,date_first_verified as 'DFV'
,date_last_verified as 'DLV'
,intensity as 'intensity'
,city
,state
,zip
,country
,region
,sub_level_industry
from fulfillment.dbo.ph_loc_duns_core u
where dnb_duns_nbr NOT IN (SELECT DISTINCT dnb_duns_nbr FROM fulfillment.dbo.ph_loc_duns_core WHERE vendor_id IN  (132, 145) AND category_id = 59)
AND product_id IN (1319,10481,862,704,1041,12673,717,4663,4713,593,12671,737,993,4558,616,1347,6453,12476,12670,6496)
AND country = 'Canada'
ORDER BY intensity DESC

--companies HG DNB File with same target products as Client  DNB Prospect File
SELECT  --dnb_duns_nbr, count(*) as Installs
Company
,URL
,dnb_duns_nbr as 'DUNS #'
,Product
,Vendor
,date_first_verified as 'DFV'
,date_last_verified as 'DLV'
,intensity as 'intensity'
,city
,state
,zip
,country
,region
,sub_level_industry
from fulfillment.dbo.ph_loc_duns_core u
where product_id IN (1319,10481,862,704,1041,12673,717,4663,4713,593,12671,737,993,4558,616,1347,6453,12476,12670,6496)
AND vendor_id NOT IN  (132, 145)
AND NOT category_id = 59
AND country = 'Canada'
ORDER BY intensity DESC

以上是关于text 戴尔看起来像DUNS SQL的主要内容,如果未能解决你的问题,请参考以下文章

申请 DUNS 编号:“Apple Tracking Number”和“Purpose”

SQL查询还是子查询?

text 禁用输入 - 输入看起来像禁用

戴尔笔记本换过硬盘以后启动不起来怎么办?

邓白氏编码(duns number)申请以及填写方法-苹果开发者申请必用

如何处理看起来像 SQL 关键字的 SQL 列名?