From: jahan Date: April 26 1999 8:55pm Subject: Re: mysql_query problem: insert .. select List-Archive: http://lists.mysql.com/mysql/2374 Message-Id: <3724D2C3.B02006BE@pc.jaring.my> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thank you very much. But you can see that I have already tried with the others in my tried list below. Jim Faucette wrote: > jahan wrote: > > > > 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 ? > > If you're running 3.22.x INSERT INTO is supported. > > > Q. Any expert sees any problem with the query above ? > > The query is ok. The problem is that jahan@localhost doesn't have > permission to access "statistics". Check your ConnectToMYSQL routine and > make sure it's coded correctly. Then: > > Either GRANT priviledges to jahan or as root add a record to mysql's > user (and/or db) table. If the latter remember to mysqladmin reload > after the INSERT. > > jim...