MySQL Forums
Forum List  »  Optimizer & Parser

SUBQUERY PROBLEM AGAIN
Posted by: Odimar Tomazeli
Date: February 17, 2006 01:37PM

Hi guys

I tried again the subquery but doesn't work

SELECT n.Cust_no, n.Customer, n.RevenueType, n.GLAccount, n.GLLogicalAccount, n.GLGrouping, n.ProfitCenter, n.ServiceProvider, n.TotalAmountCAD, n.Amount
FROM nm1_eod n
WHERE n.PostingDate between '2005-09-01 00:00:00' and '2005-09-30 00:00:00'
AND n.Cust_no in ( SELECT DISTINCT cust_no FROM nm1_eod
WHERE PostingDate between '2005-09-01 00:00:00' and '2005-09-30 00:00:00'
AND LegalEntity IN('XNX') AND GLLogicalAccount IN ('ADJ','REVENUE') AND Submarket IN('NEX','CSG')
AND GLAccount IN ('2201000','2202000','2203000','2204000','2192100','2192105','2192110','2192125'))
Order by n.Cust_no


and after I tried to change to

SELECT n.Cust_no, n.Customer, n.RevenueType, n.GLAccount, n.GLLogicalAccount, n.GLGrouping, n.ProfitCenter, n.ServiceProvider, n.TotalAmountCAD, n.Amount
FROM nm1_eod n LEFT JOIN nm1_eod ne
ON (n.Cust_no = ne.Cust_no AND ne.PostingDate between '2005-09-01 00:00:00' and '2005-09-30 00:00:00'
AND ne.LegalEntity IN('XNX') AND ne.GLLogicalAccount IN('ADJ','REVENUE') AND ne.Submarket IN('NEX','CSG')
AND ne.GLAccount IN ('2201000','2202000','2203000','2204000','2192100','2192105','2192110','2192125'))
WHERE n.PostingDate between '2005-09-01 00:00:00' and '2005-09-30 00:00:00'
AND ne.Cust_no IS NULL
Order by n.Cust_no

What am I doing wrong?



Edited 1 time(s). Last edit at 02/17/2006 01:38PM by Odimar Tomazeli.

Options: ReplyQuote


Subject
Views
Written By
Posted
SUBQUERY PROBLEM AGAIN
2313
February 17, 2006 01:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.