Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
john_john
Starting Member
10 Posts |
Posted - 2005-07-05 : 11:58:35
|
I am trying to create a custom SQL query that accepts a particular date as the input parameter and outputs all the occurences of the employer name column after that date until the present.Here is a sample of the table that i have:Table Name: TestDate Name Type06/21/2005 abc A06/21/2005 xyz B06/21/2005 fgh A06/22/2005 asd A06/22/2005 tyr BThe output should be as follows (for an input date of 06/20/2005 and Type being A):Date Name06/21/2005 abc06/21/2005 fgh06/22/2005 asdHere is the query that I have so far and the error message that I get when I try to execute it:SELECT Format([Date],"mm/dd/yyyy") AS [Request Date], test.[Employer-name]FROM testWHERE test.[Request-Type] = 'A'GROUP BY Format([Request-Date],"mm/dd/yyyy") HAVING (((DateDiff("d",[Please enter start date in mm/dd/yyyy format],(Format([Request-Date],"mm/dd/yyyy"))))>=0))ORDER BY Format([Request-Date],"mm/dd/yyyy"); |
|
john_john
Starting Member
10 Posts |
Posted - 2005-07-05 : 12:00:37
|
Here is the error message:You tried to execute a query that does not inlcude the specified expression 'Employer-name' as part of an aggregate function. |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-07-05 : 12:03:45
|
HAVING clauses are for aggregate SELECT statements only (i.e., with GROUP BY clauses). Read up on the basic structure of a SQL SELECT in either MS Access help or do some googling. Your criteria should go in the WHERE clause.- Jeff |
 |
|
|
|
|