Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    6

    Unanswered: Help with nested queries

    Hi!

    I am trying to do a nested query but Pervasive kept giving me syntax error. This is what I am trying to do:

    select itemno, sum(qtysold) from
    (select itemno, qtysold from icitem
    union all
    select itemno, qtysold from oeitem)

    Note that the above is not the complete query.

    I heard that Pervasive cannot handle complex queries. If so, how can I go about doing a select statement from a result set?

    Thanks!

  2. #2
    Join Date
    Feb 2004
    Posts
    78
    Create a temporary table, perform two inserts (one from icitem, one from oeitem). Then select from this table.

    There are views, but they do not support the union keyword.

    OR, if you have Sql Server you could run the grouping there. Assuming you have your client pervasive odbc dsn set up on the Sql Server box, run something like the following in Query Analyser:

    select itemno, sum(qtysold) from openrowset('MSDASQL','DSN=whatever','select itemno, qtysold from icitem union all select itemno, qtysold from oeitem')
    group by itemno

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •