Results 1 to 2 of 2

Thread: SQL Query Export Product Categories

  1. #1
    Join Date
    May 2011
    Posts
    61

    Default SQL Query Export Product Categories

    Hello, I am trying to figure out which of my products I have in my store that are not mapped, I feel like I have well over a few hundred that havn't been mapped over the months. I'd like a query to pull the products that are mapped, to show me what category they are in and I want to show the products that do not currently have a mapping as well. Thank you.

  2. #2
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    330

    Default

    Code:
    select p.ProductID, p.Name, pc.CategoryID, c.Name
    from Product as p (nolock)
    left join ProductCategory as pc (nolock) on p.ProductID=pc.ProductID
    left join Category as c (nolock) on pc.CategoryID=c.CategoryID
    order by 3,1
    The non-mapped ones will be at the top of the list with nulls for pc.categoryid and c.name.

    You'll probably want similar for the other entities, eg distributor, section, etc. if you use them
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •