Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:45:34+00:00 2026-06-13T21:45:34+00:00

I have a CSV import into a temp_import_table in which I’m validating the imported

  • 0

I have a CSV import into a temp_import_table in which I’m validating the imported data before commiting to the database (mysql 5.0.88).

I’m trying to search the records in the validation table for duplicate entries, but I can’t get it to work like this:

<cfquery datasource="#session.datasource#">
    UPDATE import_pricat_csv
    SET err = "ja", errtxt = "duplicate EAN"
    WHERE iln = <cfqueryparam value="#Session.logId#" cfsqltype="cf_sql_varchar" maxlength="16">
        AND ean IN (
            SELECT ean
            FROM import_pricat_csv
            GROUP BY ean
            HAVING COUNT(ean) > 1
            )
</cfquery>

This throws an error:

You can't specify target table 'import_pricat_csv' for update in FROM clause 

Question:
Is this not possible? Is there a better way than to loop once to get duplicates and a second time to set dup-records to err="yes"

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:45:35+00:00Added an answer on June 13, 2026 at 9:45 pm

    You can use the multiple-table UPDATE syntax to join with the materialised group results:

    UPDATE import_pricate_csv NATURAL JOIN (
      SELECT ean FROM import_pricate_csv GROUP BY ean HAVING COUNT(*) > 1
    ) t SET
      import_pricate_csv.err    = 'ja',
      import_pricate_csv.errtxt = 'duplicate EAN'
    ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some CSV data files that I want to import into mySQL. I
I have about 28 csv files and I need to import this into database
I'm sitting on a CSV import into a database trying to think of ways
Is it possible to import csv data into mysql and automatically create the column
I have a batch job that creates some CSV files, which I import into
I have a set of files I am trying to import into MySQL. Each
I have several files about 15k each of CSV data I need to import
I have a CSV file and I want to bulk-import this file into my
I have data in a CSV file that looks like: 2745,00,8824,02/15/99,-850.00,-144.20,0.00,0.00,0.00,0.00,-994.20,0.00, I'm trying to
I have requirement to import Excel file in MySQL database using Java. I Googled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.