Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Canada
    Posts
    1

    Unanswered: Query from another query?

    Is it possible to query fields from another query with Btrieve?

    Example:

    SELECT T.Product, SUM(T.Cost), SUM(T.Saving)
    FROM (SELECT Product, Cost, Saving FROM Products) AS T
    GROUP BY T.Product
    ORDER BY T.Product

    Thanks in advance for your help!

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    You can use a sub query but you can't use it to specify the table name. What exactly are you trying to do with your query?
    In addition, even if it did work, the select you're using as the sub query wouldn't be guaranteed to return one field and one record which is what it would need to do in order to be a "tablename".
    Doesn't:
    SELECT T.Product, SUM(T.Cost), SUM(T.Saving)
    FROM Products AS T
    GROUP BY T.Product
    ORDER BY T.Product
    fulfill your needs?
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

Posting Permissions

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