[Skip to main content](#vessel-content)

#   Display orders where ONLY Product X was purchased

##

- **[cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")**
- [![cpaschen's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/12420-cpaschen "View cpaschen's Profile") Topic Author
- [ Offline](/forum/user/12420-cpaschen)

Less More

- Posts: 196
- Thank you received: 6
-
-
-
- [](http://www.paschencommunications.com)
-

10 years 1 month ago [\#252065](#252065) by [cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")  *[Display orders where ONLY Product X was purchased](/forum/36-reports-statistics/886842-display-orders-where-only-product-x-was-purchased#252065 "-- HikaShop version -- : 2.6.x -- Joomla version -- : 3.6.2 -- PHP version -- : 7.x -- Browser(s) name and version -- : var.  Is there any way to create a report that shows all orders where Product X was purchased but NO OTHER products were purchased?  If they purchased Product X AND Product Y I don't want that in the report.  If it's not available somehow within the report system, can you give any tips on how to do that via sql?")* was created by *[cpaschen](/forum/user/12420-cpaschen "View cpaschen's Profile")*

-- HikaShop version -- : 2.6.x
-- Joomla version -- : 3.6.2
-- PHP version -- : 7.x
-- Browser(s) name and version -- : var.

Is there any way to create a report that shows all orders where Product X was purchased but NO OTHER products were purchased?

If they purchased Product X AND Product Y I don't want that in the report.

If it's not available somehow within the report system, can you give any tips on how to do that via sql?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM2LXJlcG9ydHMtc3RhdGlzdGljcy84ODY4NDItZGlzcGxheS1vcmRlcnMtd2hlcmUtb25seS1wcm9kdWN0LXgtd2FzLXB1cmNoYXNlZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

10 years 1 month ago [\#252079](#252079) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display orders where ONLY Product X was purchased](/forum/36-reports-statistics/886842-display-orders-where-only-product-x-was-purchased#252079 "-- HikaShop version -- : 2.6.x -- Joomla version -- : 3.6.2 -- PHP version -- : 7.x -- Browser(s) name and version -- : var.  Is there any way to create a report that shows all orders where Product X was purchased but NO OTHER products were purchased?  If they purchased Product X AND Product Y I don't want that in the report.  If it's not available somehow within the report system, can you give any tips on how to do that via sql?")*

Hi,

I don't see a way to do that with either the reports system or the mass actions system.
It will require a custom MySQL query.
Something like that for example (to be tested):
SELECT o.*, op1.* FROM #__hikashop_order as o LEFT JOIN #__hikashop_order_product as op1 ON o.order_id = op1.order_id AND op1.product_id = XXX LEFT JOIN #__hikashop_order_product as op2 ON o.order_id = op2.order_id AND op2.product_id != XXX WHERE op2.product_id IS NULL;

Here with load all the orders with a product with the id XXX and with no products with the id different from XXX.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM2LXJlcG9ydHMtc3RhdGlzdGljcy84ODY4NDItZGlzcGxheS1vcmRlcnMtd2hlcmUtb25seS1wcm9kdWN0LXgtd2FzLXB1cmNoYXNlZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.060 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
