If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Nested SQL Queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-08, 19:18
iroskelley iroskelley is offline
Registered User
 
Join Date: Apr 2008
Posts: 8
Question 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
Reply With Quote
  #2 (permalink)  
Old 06-02-08, 21:03
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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.
Reply With Quote
  #3 (permalink)  
Old 06-09-08, 19:12
iroskelley iroskelley is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On