Why are basic SQL questions being asked in the SQLite forum?


On Mon, Apr 29, 2013 at 5:06 PM, Igor Korot <[email protected]> wrote:
> Hi, ALL,
>
> CREATE TABLE foo( a integer, b integer);
> INSERT INTO foo VALUES( 1,1);
> INSERT INTO foo VALUES( 1,2);
> INSERT INTO foo VALUES( 1,3);
> INSERT INTO foo VALUES( 2,1);
> INSERT INTO foo VALUES( 2,2);
> INSERT INTO foo VALUES( 2,3);
>
> CREATE TABLE bar( a integer, b integer, c integer);
>
> INSERT INTO bar VALUES((SELECT a, b FROM foo),1); // fails
> INSERT INTO bar( a, b ) VALUES( (SELECT a, b FROM foo) ); //fails
>
> What is the correct syntax?
>
> Basically I need bar to have records from foo with field c to be 1, so:
>
> SELECT * FROM bar;
> 1 1 1
> 1 2 1
> 1 3 1
> 2 1 1
> 2 2 1
> 2 3 1
>
> Thank you.
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



-- 

Markus Diersbock
SwingNote
Marblehead, MA

C 781.929.0693
F 888.654.6068
------------------------------------
This e-mail is intended solely for the person or entity to which it is
addressed and may contain confidential information. If you have
received this e-mail in error, please contact the sender immediately
and delete the material from any computer. Any review, dissemination,
copying, printing or other use of this e-mail by persons or entities
other than the addressee is prohibited.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to