RE: Subselects and INSERT statements with McKoi

"Christopher Brown" <[email protected]>
Newsgroups gmane.comp.db.mckoi
Message-ID <[email protected]>
OK, thanks.

Can this approach be adapted so that for a table with multiple foreign keys,
I can use different subselects (one per foreign key) ?  That'd be very
useful...

 - Chris

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tobias
Downer
Sent: 11 February 2005 03:17
To: [email protected]
Subject: Re: Subselects and INSERT statements with McKoi

Hi Chris,

The following query will work as intended;

   INSERT INTO SKILLS (ID, NAME, DESCRIPTION)
     SELECT MAX(ID)+1, 'Java', 'Java programming' FROM SKILLS

Toby.

Christopher Brown wrote:

> Hi,
> 
> I tried the following query:
> 
> INSERT INTO SKILLS (ID, NAME, DESCRIPTION) VALUES ((SELECT MAX(ID)+1 
> FROM SKILLS), "Java", "Java programming");
> 
> ...on a table defined as:
> 
> CREATE TABLE IF NOT EXISTS SKILLS (
>  ID                     INTEGER       NOT NULL,
>  NAME                   VARCHAR(32)   NOT NULL,
>  DESCRIPTION            VARCHAR(4096) NOT NULL,
>  PRIMARY KEY (ID),
>  UNIQUE(NAME)
> );
> 
> McKoi DB's SQL parser rejects this query.  Is there any way I can 
> perform something along those lines without triggers/sequences?
> 
> Thanks,
> Chris B



---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/ To
unsubscribe, send a message to [email protected]





---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.