Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Query Problem

Status
Not open for further replies.

BazookaJo

Programmer
Jan 16, 2004
7
GB
Using Delphi's Database Explorer on a Paradox table and cannot seem to get a nested query to reference the outer table e.g.

SELECT
PayFreq,
(select count(*) from LocalEmps2 AS E2
WHERE E2.PayFreq = E1.PayFreq) FCount
FROM LocalEmps1 E1
GROUP BY PayFreq

Returns FCount as zero whether there are any matching records or not (even when the tables are identical).

Many thanks in advance.

Paul.
 
Paul,

Not sure exactly what you are trying to achieve but try

select PayFreq, count(*) FCount
from LocalEmps2 E2, LocalEmps1 E1
WHERE E2.PayFreq = E1.PayFreq
GROUP BY PayFreq

Regards

Bystander
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top