Re: Access sql question
| From: | Andrian Pervazov | Date: | Tue, 10 Oct 2000 13:44:00 +0000 |
| Subject: | Re: Access sql question | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3096@lists.php.net to get a copy of this message | ||
Thank you for pointing it out. It's my oversight - when quoting the
original message I removed the VALUES operator from the subselect, but
forgot the brackets.
Andrian
Holger Böhnke wrote:
>
> discard the brackets around the select field list:
>
> $sql = "INSERT INTO hello
> (department,telephone,address1,address2,city,state,zip,floor)
> SELECT department,telephone,address1,address2,city,state,zip,floor
> FROM hello2";
>
> hb
>
> ----- Original Message -----
> From: "Asendorf, John" <JAsendorf@lcounty.com>
> To: "Andrian Pervazov" <apervazov@aspen-marketing.com>;
> <alain@samoun.com>
> Cc: "Php-Windows@Lists. Php. Net (E-mail)" <php-windows@lists.php.net>
> Sent: Tuesday, October 10, 2000 3:31 PM
> Subject: RE: [PHP-WIN] Access sql question
>
> > OK, that seemed much closer....
> >
> > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Number of
> > query values and destination fields are not the same., SQL state 21S01 in
> > SQLPrepare in D:\InetPub\wwwroot\is\website\test_center\access\dbinsert.php
> > on line 53
> >
> > $sql = "INSERT INTO hello
> > (department,telephone,address1,address2,city,state,zip,floor)
> > SELECT (department,telephone,address1,address2,city,state,zip,floor)
> > FROM hello2";
> >
> >
> >
> > ---------------------
> > John Asendorf - jasendorf@lcounty.com
> > Web Applications Developer
> > http://www.lcounty.com - NEW FEATURES ADDED DAILY!
> > Licking County, Ohio, USA
> > 740-349-3631
> >
> >
> > > -----Original Message-----
> > > From: Andrian Pervazov [mailto:apervazov@aspen-marketing.com]
> > > Sent: Tuesday, October 10, 2000 8:56 AM
> > > To: alain@samoun.com
> > > Cc: Php-Windows@Lists. Php. Net (E-mail)
> > > Subject: Re: [PHP-WIN] Access sql question
> > >
> > >
> > > It should be "insert into table2 (field1,field2) select
> > > (field1n,field2n) from table1
> > >
> > > At least that's how it is on SQL Server
> > >
> > > Andrian
> > >
> > > alain samoun wrote:
> > > >
> > > > Slightly OT:
> > > > I'm not too familiar with Access db, can I do something like:
> > > > $sql = "insert into table2 (field1,field2) values( select
> > > (field1n,field2n)
> > > > from table1)";
> > > > where the corresponding fields have the same type.
> > > > Message from Alain Samoun
> > > > alain@samoun.com
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> > > > For additional commands, e-mail: php-windows-help@lists.php.net
> > > > To contact the list administrators, e-mail:
> > > php-list-admin@lists.php.net
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-windows-help@lists.php.net
> > > To contact the list administrators, e-mail:
> > > php-list-admin@lists.php.net
> > >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-windows-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net