List:General Discussion« Previous MessageNext Message »
From:jahan Date:April 26 1999 8:48am
Subject:mysql_query problem: insert .. select
View as plain text  
PostCodes
- ID- auto
- City  char 50
- PostCode char 20

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

This is the call I make .

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


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

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 )


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

Thank you very much.

Jahan




Thread
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