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

Syntax error 1

Status
Not open for further replies.

VAMick

Programmer
Nov 18, 2005
64
US
Can someone tell me what is wrong with my sql statement below? I keep getting a syntax error. Thanks.

SELECT * FROM (SELECT vendorname, SUM(cogs)AS sumcogs FROM spec_registrar WHERE orderdate >="2006/01/01" GROUP BY vendorname )as totals WHERE sumcogs >="10000.00
 
Hi

That looks good. And works on my test table. I usualy do some things differently :
[ul]
[li]date in ISO format[/li]
[li]date between single quotes ( ' )[/li]
[li]numbers without quotes[/li]
[li][tt]having[/tt] instead of sub-[tt]select[/tt][/li]
[/ul]
Code:
[b]select[/b]
vendorname,sum(cogs) sumcogs
[b]from[/b] spec_registrar
[b]where[/b] orderdate>=[i]'2006-01-01'[/i]
[b]group by[/b] vendorname
[b]having[/b] sumcogs>=1;
Could you post the full and exact error message ?

Feherke.
 
Ok, your version is MUCH better and worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top