Re: [sqlite] JOINning two tables provides no data

2019-01-20 Thread Jose Isaias Cabrera

Darn ti!  Thanks.


On Saturday, January 19, 2019 07:20 AM, J. King wrote,
>On January 18, 2019 12:54:32 PM EST, Jose Isaias Cabrera  
>wrote:
>>
>>sqlite> select a.a, a.b, a.c, b.d, b.e as q from a join b on a.a=b.a
>>where a.a = 1;
>>sqlite>
>>
>>This provides no result.  I expected to get,
>>
>>1|2|3||
>
>
>You appear to seek the result of a LEFT JOIN.

Yep, that's it. Thanks.

josé
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] JOINning two tables provides no data

2019-01-19 Thread J. King
On January 18, 2019 12:54:32 PM EST, Jose Isaias Cabrera  
wrote:
>
>sqlite> select a.a, a.b, a.c, b.d, b.e as q from a join b on a.a=b.a
>where a.a = 1;
>sqlite>
>
>This provides no result.  I expected to get,
>
>1|2|3||


You appear to seek the result of a LEFT JOIN.
-- 
J. King
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] JOINning two tables provides no data

2019-01-19 Thread Jose Isaias Cabrera

Greetings!

Imagine this scenario,

create table a (a, b, c);
create table b (a, d, e);
insert into a values (1, 2, 3);
insert into a values (2, 3, 4);
insert into a values (3, 4, 5);
select a.a, a.b, a.c, b.d, b.e as q from a join b on a.a=b.a where a.a = 1;

sqlite> select a.a, a.b, a.c, b.d, b.e as q from a join b on a.a=b.a where a.a 
= 1;
sqlite>

This provides no result.  I expected to get,

1|2|3||

If I add this insert,

insert into b values (1, 4, 5);

and do the same select,

sqlite> select a.a, a.b, a.c, b.d, b.e as q from a join b on a.a=b.a where a.a 
= 1;
1|2|3|4|5
sqlite>

Is there a way to do a select and get

1|2|3||

Or do I have to insert values to the b table?  Thanks.

josé
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users