Re: Access sql question
| From: | Alain Samoun | Date: | Tue, 10 Oct 2000 15:58:14 +0000 |
| Subject: | Re: Access sql question | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3110@lists.php.net to get a copy of this message | ||
Thanks to everybody!
I wasn't awake last night with this..
Nice to get up in the morning and have your problem
solved by your friends during the night..
Alain
On Tue, Oct 10, 2000 at 09:45:08AM -0400, Asendorf, John wrote:
> MS Access insert into from another table with same fields
>
> That did it...
>
> $sql = "INSERT INTO hello
> (department,telephone,address1,address2,city,state,zip,floor)
> SELECT department,telephone,address1,address2,city,state,zip,floor
> FROM hello2";
>
> SO.... here's the convention:
>
> $sql = "INSERT INTO table1 (field1,field2,field3,field4)
> SELECT field1n,field2n,field3n,field4n
> FROM table2";
>
> ---------------------
> 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: Holger Böhnke [mailto:holger.boehnke@familymail.de]
> > Sent: Tuesday, October 10, 2000 9:40 AM
> > To: php-windows@lists.php.net
> > Subject: Re: [PHP-WIN] Access sql question
> >
> >
> > 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
> >