Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Posts
    8

    Question Unanswered: Nested SQL Queries

    Hello - First off, I want to thank everyone on the forum.

    I am pretty new to Pervasive and have a syntax question. I do a lot of reporting, where I would like to utilize nested queries. I came from using Oracle and SQL Server and never had any troubles doing this in either. Below, I have included the code that I would write if I were in Oracle, since it's probably easier to see the code than hear me trying to explain myself :-)


    SELECT A.job, A.sum_a, B.b
    FROM
    (select job, sum(a) sum_a from table_A) A,
    (select job, b from table_B) B
    WHERE A.job = B.job (+)*
    *implies Left Outer Join in Oracle

    This is maybe not the most practical example, but I think it does show what I am attempting to do very well. Any expertise would be much appreciated.

    Cheers,
    ian

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    I'm not sure if this helps or not but here's an example of a Left Outer Join in Pervasive:

    SELECT * FROM (Emp LEFT OUTER JOIN Dept ON Emp.DeptID =
    Dept.DeptID) LEFT OUTER JOIN Addr ON Emp.EmpID =
    Addr.EmpID

    It's from http://www.pervasive.com/library/doc...ref-04-55.html

    As a quick test, I think this might work based on your example:
    select a.job, sum(a) sum_a, b.job from table_a a, table_b b where a.job = b.job group by a.job, b.job
    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.

  3. #3
    Join Date
    Apr 2008
    Posts
    8

    Thanks for your help

    Thank you again for your expertise. I ended up working around the problem with Crystal. However, now I am running into performance issues... and that leads to my next post

Posting Permissions

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