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

Query Question

Status
Not open for further replies.

brainmetz

Technical User
Feb 12, 2003
34
US
Everytime I run the following code:

SELECT (All_Urls.[Computer Name]), (-1 * (All_Urls.[URL Address] LIKE '*att*') * Sum (All_Urls.[SumOfTotal Time])) AS [SumOfSumOfTotal Time]
FROM [All_Urls]
GROUP BY (All_Urls.[Computer Name]);

I recieve an error stating:

You tried to execute a query that does not include the specified expression '(-1 * (All_Urls.[URL Address] LIKE '*att*') * Sum (All_Urls.[SumOfTotal Time])' as part of an aggregate function.

Can anyone please help me decifer this message.

Thanks in advance.
 
It looks like you are trying to perform math with a string function.

What are you trying to accomplish with that expression between the two commas?

If you are selecting records for *att*, wouldn't you need a WHERE or HAVING clause?

Try creating the query in the query grid and see what it comes up with for SQL.
 
Are you trying to multiply Sum (All_Urls.[SumOfTotal Time]) by -1 when (-1 * (All_Urls.[URL Address] is LIKE '*att*') ?

If so, you might want to try:

IIf(All_Urls.[URL Address] LIKE '*att*', (Sum (All_Urls.[SumOfTotal Time])*-1))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top