From: Erland Sommarskog on 13 Dec 2009 09:51 roma_victa via SQLMonster.com (u56444(a)uwe) writes: > hi i have tried this query but i get the following error message > > "No value given for one or more required parameter" > "SELECT UserName, TotalPageCount = SUM(NumberOfPages) FROM > details GROUP BY UserName HAVING(SUM(NumberOfPages) > 10) ORDER BY > TotalPageCount DESC" This script run successfully on my machine: CREATE TABLE details (UserName varchar(20) NOT NULL, NumberOfPages int NOT NULL) go SELECT UserName, TotalPageCount = SUM(NumberOfPages) FROM details GROUP BY UserName HAVING (SUM(NumberOfPages) > 10) ORDER BY TotalPageCount DESC go drop table details The query is the same as yours, just reformatted. The error message you quote, does not exist in SQL 2005, and it looks like it comes from your client API. But since you have not given any information about you environment, I cannot help more. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
From: roma_victa via SQLMonster.com on 13 Dec 2009 10:30 with out TotalPageCount = SUM(NumberOfPages) it works fine like this but is it because am running it on access SELECT UserName FROM details GROUP BY UserName HAVING(SUM(NumberOfPages) > 10) ORDER BY TotalPageCount DESC Erland Sommarskog wrote: >> hi i have tried this query but i get the following error message >> >> "No value given for one or more required parameter" >> "SELECT UserName, TotalPageCount = SUM(NumberOfPages) FROM >> details GROUP BY UserName HAVING(SUM(NumberOfPages) > 10) ORDER BY >> TotalPageCount DESC" > >This script run successfully on my machine: > > CREATE TABLE details (UserName varchar(20) NOT NULL, > NumberOfPages int NOT NULL) > go > SELECT UserName, TotalPageCount = SUM(NumberOfPages) > FROM details > GROUP BY UserName > HAVING (SUM(NumberOfPages) > 10) > ORDER BY TotalPageCount DESC > go > drop table details > >The query is the same as yours, just reformatted. > >The error message you quote, does not exist in SQL 2005, and it looks >like it comes from your client API. But since you have not given any >information about you environment, I cannot help more. > -- Message posted via http://www.sqlmonster.com
From: Erland Sommarskog on 13 Dec 2009 10:45 roma_victa via SQLMonster.com (u56444(a)uwe) writes: > with out TotalPageCount = SUM(NumberOfPages) it works fine > like this but is it because am running it on access > > SELECT UserName FROM > details GROUP BY UserName HAVING(SUM(NumberOfPages) > 10) ORDER BY > TotalPageCount DESC This is an SQL Server newsgroup. If you are using Access, you need to ask for help in a forum devoted to Access. There are considerable differences between the SQL dialects in SQL Server and Access. (Although in this particular case the syntax perfectly compliant with about all SQL standards. But that does not help if your DBMS does not support it.) -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
First
|
Prev
|
Pages: 1 2 Prev: Nullable Foreign key constriants Next: XML input Parameter C# (Stored Proc) |