--- Lee Crain <[EMAIL PROTECTED]> wrote:
> I've queried it in both the command line interface and via an
> sqlite3_exec() call in a C++ environment.
You must have a typo somewhere.
SQLite version 3.4.1
Enter ".help" for instructions
sqlite> CREATE TABLE Items(items_idx, name, active);
sqlite> INSERT INTO "Items" VALUES(1,'dog','T');
sqlite> INSERT INTO "Items" VALUES(2,'cat','A');
sqlite> INSERT INTO "Items" VALUES(1777,'pig','G');
sqlite> CREATE TABLE RelatedItems(item, related_item);
sqlite> INSERT INTO "RelatedItems" VALUES(1,2);
sqlite> INSERT INTO "RelatedItems" VALUES(1777,1);
sqlite> .mode column
sqlite> .header on
sqlite> SELECT Items.items_idx, Items.name, Items.active FROM Items
...> WHERE active = 'T' AND Items.items_idx IN
...> (SELECT related_item FROM RelatedItems WHERE RelatedItems.item = 1777
...> UNION
...> SELECT item FROM RelatedItems WHERE RelatedItems.related_item = 1777)
...> ORDER BY Items.name ASC;
items_idx name active
---------- ---------- ----------
1 dog T
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------