Results 1 to 3 of 3

Thread: double writing

  1. #1
    Join Date
    Feb 2004
    Location
    Sweden
    Posts
    1

    Unanswered: double writing

    INSERT INTO book (isbn, title, in_stock, price, author_id, type_id, supplier_id)
    SELECT isbn, title, in_stock, price, author_id, type_id, supplier_id
    FROM (SELECT isbn, title, in_store AS in_stock, price, author.id AS author_id,
    type_of_book.id AS type_id, supplier.id AS supplier_id FROM GROSSISTLISTA, author, type_of_book, supplier
    WHERE GROSSISTLISTA.author = author.name AND GROSSISTLISTA.cathegory = type_of_book.name
    AND GROSSISTLISTA.supplier = supplier.name);

    for some strange reason this tries to write every row twice
    but when i tried to test run this on a different database it didnt

    GROSSISTLISTA is a synonym for a database connection

    any idea what to do? i've tried with distinct after both selects but that wont do much good.

    im desperate

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: double writing

    If you put DISTINCT after the first SELECT, that will surely remove the duplicates - that is after all what DISTINCT does.

    But the fact that you get each record twice suggests something is wrong with the query - like a missing join condition?

  3. #3
    Join Date
    Nov 2002
    Posts
    833
    did you submit a / in the succeeding column which would leed to another execution of the stmt...

Posting Permissions

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