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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error. In query expression ‘(Select count(*)from Master Table a

Status
Not open for further replies.

TJVFree

Technical User
Nov 22, 2010
236
US
Syntax error. In query expression ‘(Select count(*)from Master Table as B where Master Table.12Month > B.12Month);

I’m receiving this syntax error when I’m trying to add:
“Rank: (Select count(*) from qryCustomerTotals as B where qryCustomerTotals.CustomerTotal > B.customerTotal)”

Is there a simple way to correct this?

Thanks in advance for any help
TCB

Code:
TRANSFORM Sum([Master Table].AMOUNT_ACTUAL_LOAN) AS SumOfAMOUNT_ACTUAL_LOAN
SELECT [Master Table].orig_code AS OMNI_Number, [Master Table].NAME_WHOLESALE_ACCOUNT_EXEC AS Account_Executive_Name, Sum([Master Table].AMOUNT_ACTUAL_LOAN) AS [Total Of AMOUNT_ACTUAL_LOAN], Sum(IIf([CORRESPONDENT_PURCHASE_DATE]>DateAdd("m",-3,Date()),[Amount_Actual_Loan],0)) AS 3Month, Sum(IIf([CORRESPONDENT_PURCHASE_DATE]>DateAdd("m",-6,Date()),[Amount_Actual_Loan],0)) AS 6Month, Sum(IIf([CORRESPONDENT_PURCHASE_DATE]>DateAdd("m",-9,Date()),[Amount_Actual_Loan],0)) AS 9Month, Sum(IIf([CORRESPONDENT_PURCHASE_DATE]>DateAdd("m",-12,Date()),[Amount_Actual_Loan],0)) AS 12Month, Sum(IIf([CORRESPONDENT_PURCHASE_DATE]>DateAdd("m",-12,Date()),[Amount_Actual_Loan],0)) AS CustomerTotal
FROM [Master Table]
WHERE ((([Master Table].CORRESPONDENT_PURCHASE_DATE)>#1/1/2010#))
GROUP BY [Master Table].orig_code, [Master Table].NAME_WHOLESALE_ACCOUNT_EXEC
PIVOT Format([CORRESPONDENT_PURCHASE_DATE],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
 
(Select count(*) from [!][[/!]Master Table[!]][/!] as B where [!][[/!]Master Table[!]][/!].12Month > B.12Month)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm still getting the same error. any ideas of what I can try next. thanks
 
Duane, do you have a recommendation for what I can try next?
 
What is the EXACT new error message you get ACTUALLY ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Syntax error. In query expression ‘(Select count(*)from [Master Table] as B where [Master Table].12Month > B.12Month);
 
Why a semicolon ?
Why not a space before from ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top