Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 4 of 4 total |
Insert + Select + Values |
Fri, Jun 20 2008 4:58 AM | Permanent Link |
Dave | Hi
I want to insert values into a table from another table AND a constant. E.g. Table1 has fields: Name Country Status My SQL is: Insert Into Table 1 (Name,Country,Status) SELECT Name,Country FROM Table2 But for each inserted row i also want to set the Status to say "3" I can't do a second pass because there might already be Status "1", Status "2", etc in the table (from previous tasks). Apologies for my poor knowledge of SQL. Dave |
Fri, Jun 20 2008 5:10 AM | Permanent Link |
Dave | Sorry, I researched some more and see that this is valid in DBISAM:
Insert Into Table 1 (Status,Name,Country) SELECT 3,Name,Country FROM Table2 Whereas this does not work (prior to EDB): Insert Into Table 1 (Status,Name,Country) Values (3, (SELECT Name,Country FROM Table2) ) |
Fri, Jun 20 2008 5:11 AM | Permanent Link |
Fernando Dias Team Elevate | Dave,
> I want to insert values into a table from another table AND a constant. You can do it as follows: INSERT INTO Table1 (Name,Country,Status) SELECT Name, Country, 3 FROM Table2 -- Fernando Dias [Team Elevate] |
Fri, Jun 20 2008 5:24 AM | Permanent Link |
Fernando Dias Team Elevate | Dave,
> Whereas this does not work (prior to EDB): That will not work in EDB too. -- Fernando Dias [Team Elevate] |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |