Re: [sqlite] Using result of subquery both as value and conditional test...

2009-02-24 Thread Hoover, Jeffrey
nal Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of John Machin Sent: Tuesday, February 24, 2009 3:01 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Using result of subquery both as value and conditional test... On 25/02/200

Re: [sqlite] Using result of subquery both as value and conditional test...

2009-02-24 Thread John Machin
On 25/02/2009 6:15 AM, John Elrick wrote: > I may be overlooking something obvious, however, I cannot discern from > the documentation if this is possible. > > given a simple example: > > create table x (x_id integer); > create table y (y_id integer, y_value varchar); > > insert into x values (

Re: [sqlite] Using result of subquery both as value and conditional test...

2009-02-24 Thread John Elrick
D. Richard Hipp wrote: > On Feb 24, 2009, at 2:15 PM, John Elrick wrote: > > SNIP >> >> Is there any way to eliminate the second (select y_value from y where >> y_id = x_id)? If so, what would the query look like? >> >> > > SELECT coalesce((SELECT y_value FROM y WHERE y_id=x_id), 'darn')

Re: [sqlite] Using result of subquery both as value and conditional test...

2009-02-24 Thread D. Richard Hipp
On Feb 24, 2009, at 2:15 PM, John Elrick wrote: > I may be overlooking something obvious, however, I cannot discern from > the documentation if this is possible. > > given a simple example: > > create table x (x_id integer); > create table y (y_id integer, y_value varchar); > > insert into x valu

[sqlite] Using result of subquery both as value and conditional test...

2009-02-24 Thread John Elrick
I may be overlooking something obvious, however, I cannot discern from the documentation if this is possible. given a simple example: create table x (x_id integer); create table y (y_id integer, y_value varchar); insert into x values (1); insert into x values (2); insert into y values (1, 'Hell