There's nothing wrong with your query. It works fine against this schema in sqlite 3.4.1:
CREATE TABLE Items(items_idx, name, active); CREATE TABLE RelatedItems(item, related_item); What language/tool are you using to query sqlite? --- Lee Crain <[EMAIL PROTECTED]> wrote: > The query at the bottom of this email is failing on the word "UNION". (The > query works correctly in MS SQL Server.) > > I believe this is, unfortunately correct, since the SQLite documentation > does not mention the reserved word "UNION" in the set of supported and > recognized SQL words (http://www.sqlite.org/lang.html). > > Is this correct? If so, is there another way to accomplish this query as a > single query? > > Thanks, > > Lee Crain > > __________________________________________________________________ > > > 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; ____________________________________________________________________________________ Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/ ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------