can't insert into questions( ) select from questions .
the error is : not unique table or alias .
tried with insert into ... select a.field1 , a.filed2 from questions as a .
not working ;)
----- Original Message -----
From: "Brent Baisley" <brent@stripped>
To: "cristian ditoiu" <cristian.ditoiu@stripped>;
Sent: Monday, June 10, 2002 10:53 PM
Subject: Re: php+mysql+multiple lines qry
> Why not just use something like:
> insert into questions (field1,field2,...) select...
> You don't need to create temp tables for your data and all the other
> complicated stuff.
> > hello .
> > i use php 4.12 + mysql 3.23.49 on linux .
> > i've developed a online testing(quiz) -aplication that now is expected
> > behave somehow different from what i've had in mind at the begining .
> > exactly :
> > i have 3 tables (MyIsam):
> > 1. tests (id,name,desc)
> > 2. questions (id,id_test_fk,desc)
> > 3. answer(id,id_q_fk,desc,points) .
> > i want to copy a question from one test to another .
> > If i knew that from the start , i would have designed the tables
> > , but that's another problem .
> > the point is i'm trying to do a 'quick_and_dirty' patch like this :
> > ----------
> > set @test_id=$test_target;
> > set @q_id=$qid;
> > create temporary table q_temp as select * from questions;
> > create temporary table ans_temp as select * from answers;
> > insert into questions select
> > from q_temp as t2 where id=@q_id;
> > select @last:=LAST_INSERT_ID();
> > insert into answers select '',@last,score,description from ans_temp
> > id_question_fk=@q_id;
> > ------
> > where $test_target and $qid are given from php .
> > my problem is that this query works and dows what is expected when run
> > mysql ,
> > but NOT from php . No error , nada . I even tryed to do dirty thing
> > (shell_exec('mysql -u user -p password database </tmp/qry.txt')) where
> > qry.txt was generated
> > by php (containing the above code) but NO luck .
> > could you please give a suggestion or ..smth ?
> > ---------------------------------------------------------------------
> > Before posting, please check:
> > http://www.mysql.com/manual.php (the manual)
> > http://lists.mysql.com/ (the list archive)
> > To request this thread, e-mail <mysql-thread111509@stripped>
> > To unsubscribe, e-mail
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577