List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:April 25 1999 10:00pm
Subject:mysql_query problem: insert .. select
View as plain text  
>>>>> "jahan" == jahan  <jahan@stripped> writes:

jahan> PostCodes
jahan> - ID- auto
jahan> - City  char 50
jahan> - PostCode char 20

jahan> Addresses
jahan> - Name
jahan> - Age
jahan> - City char 50
jahan> - PostCode char 20

jahan> This is the call I make .

jahan> ConnectToMySQL(); // Display Error if not connected
jahan> UseDatabase("Statistics"); // Display Error if not used
jahan> if(mysql_query(&mysql,"insert into PostCodes select 0,City,PostCode
jahan> from Addresses where City !='CAL'")!=0)
jahan>    Show_error();

jahan> And I get this error.
jahan> Access denied for user: 'jahan@localhost' to database 'Statistics'

jahan> Thing that I checked.

-> Connected to MySQL - Yes
-> Can insert to PostCodes , if I drop the select part
-> Tried the <> operator
-> Works very fine in command prompt ( copy /paste, exactly )

jahan> Q. Is it built feature not to support subquery in mysql_query ?
jahan> Q. Any expert sees any problem with the query above ?

jahan> Thank you very much.


The above means that the user 'jahan@localhost' doesn't have the right 
to insert rows or update the Statistics database.

Please try this again from the 'mysql' command prompt !  If this
works, please verify with 'status' that you are really logged in as

mysql_query problem: insert .. selectjahan25 Apr
  • mysql_query problem: insert .. selectMichael Widenius26 Apr
  • Re: mysql_query problem: insert .. selectjahan26 Apr
  • Re: mysql_query problem: insert .. selectjahan26 Apr