-
Subqueries inside Subqueries
AND f.end_dte = (SELECT MAX(f.end_dte)
FROM bfg_admin.com_partic_info_stat e,
bfg_admin.db_ann_earning_hist f
WHERE f.emp_employee_id = e.db_employee_id)
AND g.amount = (SELECT MAX(g.amount)
FROM bfg_admin.db_payment_hist g,
bfg_admin.db_relationship_hist d
WHERE g.ca_indicative_id = d.ind_indicative_id)
Why would this not work? I need the Max of (f.end_dte) but only the records
that have the Max of (g.amount) to show up too. So in essence I want the
second subquery to only apply to the first subquery and not to the entire
query. Right now it only seems to be applying to the entire query.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks