SQL Procedure I am using to get my current dataset:
SELECT
DcProd.Title,
DcProd.Summary,
DcProd.Product,
EfProd.ProductStatus,
EfProd.ViewOnlyLicenses,
EfProd.FullLicenses,
DcProd.ProductType,
DcProd.Advertise,
EfProd.CustomerAccount_Id,
DcRelation.component_property_name,
DcRelation.child_item_id,
DcRelation.child_item_additional_info,
DcPageRelation.url_name_
FROM [MC_Sitefinity].[dbo].[mastercontrolproducts_mastercontrolproduct] as DcProd
LEFT JOIN [MasterControlSitefinity].[dbo].[ProductLicense] as EfProd
ON DcProd.Product = EfProd.Product_Id --matching dynamic content (Dc) products to Entity Framework (Ef) products
LEFT JOIN [MC_Sitefinity].[dbo].[sf_dynamic_content] as DcStatus
ON DcProd.base_id = DcStatus.base_id -- show only published and visible.
LEFT JOIN [MC_Sitefinity].[dbo].[sf_content_link] as DcRelation
ON DcStatus.original_content_id = DcRelation.parent_item_id --Gets related items for image and page url
LEFT JOIN [MC_Sitefinity].[dbo].[sf_page_node] as DcPageRelation
ON DcRelation.child_item_id = DcPageRelation.id --gets page url for query
where EfProd.CustomerAccount_Id = '0013000000PMwEQAA1' AND DcStatus.visible = 1 AND DcStatus.approval_workflow_state_ = 'Published'
order by ProductType
Here is the example data set returned:
http://1drv.ms/1MKjAsU (OneDrive excel spreadsheet) Or if you prefer: http://ift.tt/1IDYciW
This is not all the data returned but some of the key records I am trying to show.
You will notice we have multiple tables. What is happening is for each record on the left there are sometimes two records on the right causing duplicated rows.
What I would like if possible is (looking at last two rows) if we could combine child_item_additional_info and url_name_ on one line instead of two. As for the data in the component_property_name it could just be deleted or combined with a pipe (|) or whatever is recommended.
I have looked at cases, pivot tables, but I just am a little green when it comes to SQL and unsure how to do this.
Any help will be greatly appreciated.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire