Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Aug 2006
    Location
    ulaanbaatar
    Posts
    94
    Plugin Contributions
    0

    red flag 1062 Duplicate entry 'Customers who have never...

    I'm trying to upgrade to 1.3.8a and when I click database upgrade I got the following message:
    HTML Code:
    1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
    in:
    [INSERT INTO query_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]
    As I guess the matter was in (.) in between 'c' and 'LEFT'. Is it right (means bug) ?
    If so where it can be changed?
    If not what should I do next?
    Thank you

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 1062 Duplicate entry 'Customers who have never...

    Quote Originally Posted by LostSheep View Post
    As I guess the matter was in (.) in between 'c' and 'LEFT'. Is it right (means bug) ?
    No, it's not a bug.
    It's trying to insert a record that apparently already exists.
    Did you run the database upgrade twice for some reason?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 1062 Duplicate entry 'Customers who have never...

    Run this using the SQL Patch tool in the Admin->Tools menu:
    Code:
    DELETE from query_builder where query_name = 'Customers who have never completed a purchase';
    Then you should be able to redo the database upgrade ... again.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    May 2005
    Posts
    96
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'Customers who have never...

    Thanks DrByte for this little tip as I inadvertantly downgraded my DB Patch to 1.3.7 and couldn't get the db upgrade to allow 1.3.7 -> 1.3.8a...
    After the SQL execution, re-run the upgrade and all is well ! ! !

    Many Thanks again !
    Jim

  5. #5
    Join Date
    Mar 2006
    Location
    White Pigeon, MI
    Posts
    172
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'Customers who have never...

    I keep getting this error too. I have gone to my admin and entered: SQL Query delete portion and I have even done a fresh install of my database but no luck!

    I have been workin on this for 2 days now and very very frustrated at this point.



    1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
    in:
    [INSERT INTO zen_query_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 1062 Duplicate entry 'Customers who have never...

    Quote Originally Posted by travel124 View Post
    I keep getting this error too. I have gone to my admin and entered: SQL Query delete portion and I have even done a fresh install of my database but no luck!
    Then maybe you're hitting the wrong database or table?

    Quote Originally Posted by travel124 View Post
    [INSERT INTO zen_query_builder ...
    If you've deleted the entry, but it keeps saying it exists, then you're probably not deleting it from the right place.



    The upgrader will only attempt to run that INSERT command when you do the 1.3.7-to-1.3.8 upgrade step.
    If you've already done that step once, then naturally it would be expected that it would croak.
    If you are certain you've done everything correctly and don't care about that particular statement, edit the /zc_install/sql/mysql_zencart_upgrade_137_to_138.sql file and put a # at the beginning of that line to comment it out.
    Then cross your fingers when you run that upgrade step again.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Mar 2006
    Location
    White Pigeon, MI
    Posts
    172
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'Customers who have never...

    I am fine now.

    Thanks for your help!

    New issue with admin here: http://www.zen-cart.com/forum/showthread.php?t=84655

  8. #8
    Join Date
    Apr 2008
    Location
    Arvada, CO
    Posts
    21
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'Customers who have never...

    I really do try not to tag on to threads with such good documentation.. but I can't make it work. I keep trying what I find here on he boards but to no resolve. So with my deepest apologies can someone please have a look at my work and help me find some more things to try.

    The problems I am having.
    Can't Log in to my cart
    1062 Dup error.. can't upgrade cart to 1.38a

    Info:
    https://store.angeleyes.org/

    I am trying to upgrade from 1.3.8 to 1.3.8a to fix the "can't log in to my cart problem.
    Error code:
    Error There was a security error when trying to login.



    Error code:
    1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
    in:
    [INSERT INTO zenquery_builder (query_category, query_name, query_description , query_string) VALUES ('email,newsletters', 'Customers who have never completed a purchase', 'For sending newsletter to all customers who registered but have never completed a purchase', 'SELECT DISTINCT c.customers_email_address as customers_email_address, c.customers_lastname as customers_lastname, c.customers_firstname as customers_firstname FROM TABLE_CUSTOMERS c LEFT JOIN TABLE_ORDERS o ON c.customers_id=o.customers_id WHERE o.date_purchased IS NULL');]


    Any help is very appreciated.. DrByte, looks like you help more people that Red Cross does.. once I get this thing working you get a Gift Certificate in appreciation. Dubious prize I know, but its just a token of appreciation.

    Cam
    Rj Dollen

  9. #9
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 1062 Duplicate entry 'Customers who have never...

    Another approach you can try is to add a # before the INSERT statement mentioned ... which will cause it not to be processed.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Apr 2008
    Location
    Arvada, CO
    Posts
    21
    Plugin Contributions
    0

    Default Re: 1062 Duplicate entry 'Customers who have never...

    Quote Originally Posted by DrByte View Post
    Another approach you can try is to add a # before the INSERT statement mentioned ... which will cause it not to be processed.
    I am shamed a little here to say.. I have no idea what to do with that chuck of code.. the "[INSERT INTO zen_query_builder (...." bit is a mystery to me.

    So "#[INSERT INTO zen_query_builder (...." goes where?

    Cam

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How to remove all customers who have never ordered before?
    By ebookba in forum General Questions
    Replies: 21
    Last Post: 12 Jan 2018, 02:45 PM
  2. 1062 Duplicate entry
    By pkohn11 in forum General Questions
    Replies: 4
    Last Post: 5 Apr 2011, 09:09 PM
  3. 1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
    By maperr55 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 5
    Last Post: 9 Jul 2010, 05:14 AM
  4. Customers who have never completed an order?
    By MagicMan in forum General Questions
    Replies: 1
    Last Post: 24 Jul 2008, 06:44 PM
  5. 1062 Duplicate entry 'Customers who have never completed a purchase' for key 2
    By elliesupport in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 2 Jul 2008, 09:04 PM

Posting Permissions

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