Hi, i'm having problem in query. A table with 2 fields, name and salary. I create a query to display the sum of salary if the salary is larger than a certain amount. The sample code is like this :
SELECT 'sum(salary) AS total'
WHERE 'total' > 4000;
but it keep giving me "Data Type Mismatch" error message. Then i separate the query into 2, the first display the total and the second check the total. In this case, no problem. But this method is not suitable in my programming logic. So, anyone have any idea ??
I tested directly using MS Access, but your sql code was not stable. No error but sometime ok sometime no output after i added extra record rows on tblUser. I also tried the sql code on VB6, ASP and ASP.Net but the results remain the same. Possibly the different version of MS Access ? I'm using MS Access 2000.
The sql code i wrote in #3 was fine, i got the correct output but dont know why MS Access will add ". AS [%$##@_Alias]" behind "FROM" of #3.
Oh, now i understand. Sorry if i'm confusing you, what i mean is to display the sum if the sum is bigger than a certain amount. About the unstable, when i change the amount of "salary" in "tblUser" then the output of the query will be empty. Maybe is like what you said, if the "salary" of first record is bigger than a certain amount then it will display the sum. Anyway, i still want to say thanks.