Post by SCREWLOOSE2000 » Thu Dec 13, 2018 9:31 pm

Hi all, im looking for some help. I have got this far with my sql query in myphpadmin "SELECT model, COUNT(*) c FROM oc_product GROUP BY model HAVING c>1"
This displays all the model duplicates, what i need it to do is also display all the corrisponding prices, discriptions ect.

Any ideas?

Thanks.


Posts

Joined
Tue Sep 06, 2016 8:57 pm

Post by ocmta » Fri Dec 14, 2018 12:24 am

This will give you only one row per model:

Code: Select all

SELECT p.*, pd.*, COUNT(*) AS c FROM oc_product p, oc_product_description pd WHERE pd.product_id = p.product_id AND pd.language_id = 1 GROUP BY p.model HAVING c>1;
And this will give you all rows with the same model, but only those models with more than 1 row:

Code: Select all

SELECT p.*, pd.*, (SELECT COUNT(*) FROM oc_product p1 WHERE p1.model = p.model) AS c FROM oc_product p, oc_product_description pd WHERE pd.product_id = p.product_id AND pd.language_id = 1 AND (SELECT COUNT(*) FROM oc_product p1 WHERE p1.model = p.model) > 1;

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am

Who is online

Users browsing this forum: No registered users and 412 guests