sql - Can anyone tell me what is wrong with my query? -


select      t1.description, t1.type, t1.salespotential , t2.startdate,       t3.project_region, t3.job_type      sysdba.opportunity t1,     select t1.type, count(*)     opportunity     group by type, join      sysdba.activity t2 on t1.accountid = t2.accountid join      sysdba.c_opportunity_ext t3 on t1.opportunityid = t3.opportunityid      closeprobability > 70 

the line "group by type," has bad syntax.

use 1 by. type reserved word. if refers field, use `type` (surround field name ` character). comma @ end shouldn't there.

group `type` 

if using mysql, it's practice put sub-queries inside parentesis. becomes "derived table" , needs name. i've used "sometemptable" in example:

(select t1.type, count(*)     opportunity     group `type`) sometemptable 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -