sql - Transferring data from different tables into dimension table -
i trying fill product dimension data adventureworks database using following query
select product.class, product.color, product.daystomanufacture, product.discontinueddate, product.productline, product.finishedgoodsflag, product.listprice, product.makeflag, product.name productname, productdescription.[description], product.productnumber, product.reorderpoint, product.safetystocklevel, product.sellenddate, product.sellstartdate, product.size, product.standardcost, product.style, product.[weight], model.name model, product.weightunitmeasurecode, product.sizeunitmeasurecode, subcategory.name subcategoryname, category.name categoryname, photo.largephoto, photo.largephotofilename, photo.thumbnailphoto, photo.thumbnailphotofilename adventureworks2008r2.production.product product inner join adventureworks2008r2.production.productmodel model on (product.productmodelid = model.productmodelid) inner join adventureworks2008r2.production.productsubcategory subcategory on (subcategory.productsubcategoryid = product.productsubcategoryid) inner join adventureworks2008r2.production.productcategory category on (category.productcategoryid = subcategory.productcategoryid) inner join adventureworks2008r2.production.productproductphoto productphoto on (productphoto.productid = product.productid) inner join adventureworks2008r2.production.productphoto photo on (productphoto.productphotoid = photo.productphotoid) inner join adventureworks2008r2.production.productmodelproductdescriptionculture productmodeldescription on (productmodeldescription.productmodelid = model.productmodelid) inner join adventureworks2008r2.production.productdescription productdescription on (productmodeldescription.productdescriptionid = productdescription.productdescriptionid) productmodeldescription.cultureid = 'en';
however there 504 product records in product tables, query yields 294 records. after tracing query while, figured out joins product description reason deducted number of product records. question how product records (504) while getting product description information well, if not found put null
you can use full outer join productdescription table.
..... ..... inner join adventureworks2008r2.production.productmodelproductdescriptionculture productmodeldescription on (productmodeldescription.productmodelid = model.productmodelid) full outer join adventureworks2008r2.production.productdescription productdescription .....
Comments
Post a Comment