How to export all customers based on ordered items SKU?Export all guest customersI want to export all the customers who used a couponExport customers error “barkeloo payment”How to export from DB Sku - Order Number - Quantity Sold?Magento 1 retrieve customer email who ordered from specific categoryHow can I Get Sku In Products Ordered ReportsExclude one SKU from all price rulesGet all ordered products for all customersMAGENTO 2 Orders Grid Add SKU and Export to CSVExport customers list with IP address?

Error in master's thesis, I do not know what to do

Could any one tell what PN is this Chip? Thanks~

What are the rules for concealing thieves' tools (or items in general)?

Turning a hard to access nut?

Does the Shadow Magic sorcerer's Eyes of the Dark feature work on all Darkness spells or just his/her own?

Gauss brackets with double vertical lines

Is there any common country to visit for uk and schengen visa?

Output visual diagram of picture

Symbolism of 18 Journeyers

What (if any) is the reason to buy in small local stores?

Nested Dynamic SOQL Query

Should a narrator ever describe things based on a characters view instead of fact?

Hackerrank All Women's Codesprint 2019: Name the Product

"Marked down as someone wanting to sell shares." What does that mean?

Pre-Employment Background Check With Consent For Future Checks

Single word to change groups

Can a university suspend a student even when he has left university?

How to test the sharpness of a knife?

Air travel with refrigerated insulin

Do I need an EFI partition for each 18.04 ubuntu I have on my HD?

Isn't the word "experience" wrongly used in this context?

Fair way to split coins

Do people actually use the word "kaputt" in conversation?

When should a starting writer get his own webpage?



How to export all customers based on ordered items SKU?


Export all guest customersI want to export all the customers who used a couponExport customers error “barkeloo payment”How to export from DB Sku - Order Number - Quantity Sold?Magento 1 retrieve customer email who ordered from specific categoryHow can I Get Sku In Products Ordered ReportsExclude one SKU from all price rulesGet all ordered products for all customersMAGENTO 2 Orders Grid Add SKU and Export to CSVExport customers list with IP address?













1















How to find all customers who ordered a certain SKU ?










share|improve this question




























    1















    How to find all customers who ordered a certain SKU ?










    share|improve this question


























      1












      1








      1








      How to find all customers who ordered a certain SKU ?










      share|improve this question
















      How to find all customers who ordered a certain SKU ?







      magento2.2 orders export sku






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 mins ago









      Teja Bhagavan Kollepara

      3,00641949




      3,00641949










      asked 10 hours ago









      DevAndDevAnd

      159218




      159218




















          2 Answers
          2






          active

          oldest

          votes


















          0














          The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



          select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
          from sales_order o
          join sales_order_item oi on o.entity_id = oi.order_id
          where oi.sku = '[YOUR SKU HERE]';





          share|improve this answer






























            0














            Execute below script.



            <?php

            use MagentoFrameworkAppBootstrap;
            require 'app/bootstrap.php';
            $bootstrap = Bootstrap::create(BP,$_SERVER);

            $objectManager = $bootstrap->getObjectManager();
            $state = $objectManager->get('MagentoFrameworkAppState');
            $state->setAreaCode('frontend');

            $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
            $storeId = $storeManager->getStore()->getId();
            $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


            $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
            $connection = $resource->getConnection();
            $sku = '24-WB04';



            $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

            $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

            print_r($Itemcollection->getData());




            share






















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266421%2fhow-to-export-all-customers-based-on-ordered-items-sku%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



              select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
              from sales_order o
              join sales_order_item oi on o.entity_id = oi.order_id
              where oi.sku = '[YOUR SKU HERE]';





              share|improve this answer



























                0














                The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



                select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
                from sales_order o
                join sales_order_item oi on o.entity_id = oi.order_id
                where oi.sku = '[YOUR SKU HERE]';





                share|improve this answer

























                  0












                  0








                  0







                  The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



                  select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
                  from sales_order o
                  join sales_order_item oi on o.entity_id = oi.order_id
                  where oi.sku = '[YOUR SKU HERE]';





                  share|improve this answer













                  The simplest way to do that, is to run a SQL statement. For example with the following statement you get email, firstname and lastname for all customer who have ordered a product with the specified sku:



                  select distinct(o.customer_email), o.customer_firstname, o.customer_lastname 
                  from sales_order o
                  join sales_order_item oi on o.entity_id = oi.order_id
                  where oi.sku = '[YOUR SKU HERE]';






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 9 hours ago









                  HelgeBHelgeB

                  2,5781320




                  2,5781320























                      0














                      Execute below script.



                      <?php

                      use MagentoFrameworkAppBootstrap;
                      require 'app/bootstrap.php';
                      $bootstrap = Bootstrap::create(BP,$_SERVER);

                      $objectManager = $bootstrap->getObjectManager();
                      $state = $objectManager->get('MagentoFrameworkAppState');
                      $state->setAreaCode('frontend');

                      $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                      $storeId = $storeManager->getStore()->getId();
                      $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                      $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                      $connection = $resource->getConnection();
                      $sku = '24-WB04';



                      $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                      $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                      print_r($Itemcollection->getData());




                      share



























                        0














                        Execute below script.



                        <?php

                        use MagentoFrameworkAppBootstrap;
                        require 'app/bootstrap.php';
                        $bootstrap = Bootstrap::create(BP,$_SERVER);

                        $objectManager = $bootstrap->getObjectManager();
                        $state = $objectManager->get('MagentoFrameworkAppState');
                        $state->setAreaCode('frontend');

                        $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                        $storeId = $storeManager->getStore()->getId();
                        $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                        $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                        $connection = $resource->getConnection();
                        $sku = '24-WB04';



                        $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                        $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                        print_r($Itemcollection->getData());




                        share

























                          0












                          0








                          0







                          Execute below script.



                          <?php

                          use MagentoFrameworkAppBootstrap;
                          require 'app/bootstrap.php';
                          $bootstrap = Bootstrap::create(BP,$_SERVER);

                          $objectManager = $bootstrap->getObjectManager();
                          $state = $objectManager->get('MagentoFrameworkAppState');
                          $state->setAreaCode('frontend');

                          $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                          $storeId = $storeManager->getStore()->getId();
                          $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                          $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                          $connection = $resource->getConnection();
                          $sku = '24-WB04';



                          $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                          $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                          print_r($Itemcollection->getData());




                          share













                          Execute below script.



                          <?php

                          use MagentoFrameworkAppBootstrap;
                          require 'app/bootstrap.php';
                          $bootstrap = Bootstrap::create(BP,$_SERVER);

                          $objectManager = $bootstrap->getObjectManager();
                          $state = $objectManager->get('MagentoFrameworkAppState');
                          $state->setAreaCode('frontend');

                          $storeManager = $objectManager->get("MagentoStoreModelStoreManagerInterface");
                          $storeId = $storeManager->getStore()->getId();
                          $websiteId = $storeManager->getStore($storeId)->getWebsiteId();


                          $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
                          $connection = $resource->getConnection();
                          $sku = '24-WB04';



                          $Itemcollection = $objectManager->create('MagentoSalesModelOrderItem')->getCollection();

                          $Itemcollection->getSelect()->join('sales_order as order',"main_table.order_id = order.entity_id",array('order.customer_email'))->where("main_table.sku = '".$sku."'")->group(array('order.customer_email'));

                          print_r($Itemcollection->getData());





                          share











                          share


                          share










                          answered 7 hours ago









                          Amitkumar solankiAmitkumar solanki

                          373113




                          373113



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266421%2fhow-to-export-all-customers-based-on-ordered-items-sku%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Nidaros erkebispedøme

                              Birsay

                              Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?