Character found after end of sql statement SQL error (1 Viewer)

armrodnun

New member
Local time
Today, 16:57
Joined
Jul 9, 2009
Messages
8
I am trying to do a query to find the three highest balances in a access table? This is what i have on my SQL but it gives me this error: "Character found after end of sql statement"

SELECT Table1.[Advertiser Number], Table1.Name, Table1.Balance, Table1.[Amount Paid]
FROM Table1; SELECT TOP 3 MAX([Balance]) As Balance FROM [Table1];

Also, How to do a query to find the total balance and the amount paid for each person?

I Am new with Access please help me! I havve attached the file with my thread.
 

Attachments

  • db2.mdb
    308 KB · Views: 127

DCrake

Remembered
Local time
Today, 23:57
Joined
Jun 8, 2005
Messages
8,632
Code:
SELECT TOP 3 fldRefNo, Count(1) AS Cnt
FROM tblReferrals
GROUP BY fldRefNo
ORDER BY Count(1) DESC;

In this example I got the top 3 people who had the most referrals. By grouping by what I wanted and added a cnt:1 in a new column and counted that. I sorted descending, Highest first, then set the Top property to show the top 3 only.

Replicate this and you should get what you want.


David
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 23:57
Joined
Sep 12, 2006
Messages
15,614
FROM Table; SELECT TOP 3 MAX([Balance]) As Balance FROM [Table1];

maybe its objecting to the semi-colon in the middle after table1

a semi-colon is normally end of statement i think - hence you have stuff after the end-of-statement
 

Users who are viewing this thread

Top Bottom