sql server - SQL Multipart Incorrect Syntax, Aggregate Function, Multipart Identifier can not be bound -


i have been trying several hours teach myself , learn on how list customers , orders placed each of them dummy test data. want return customerid, customername, ordertypename, , count "ordercount"

i have tried few different ways , techniques found online keep running similar/different problems relating apparent simple solutions cannot figure out.

here current query.

select      c.customerid, c.customername, t.ordertypename      tblcustomer c, tblorder o, tblordertype t inner join     (select           o.customerid, count(o.customerid) ordercount               tblorder o, tblcustomer c                o.customerid = c.customerid) order customername; 

this 1 giving error of incorrect syntax near keyword 'order'.

you're mixing old-style joins comma-separated lists of tables , proper ansi standard inner join - you're not providing join condition.

my suggestion: used ansi standard , use - time!

select      c.customerid, c.customername, t.ordertypename      tblcustomer c inner join      tblorder o on ..(what links tblorder , tblcustomer??) .... inner join     tblordertype t on ....(what links ordertype , order??) .... inner join     (select           o.customerid, count(o.customerid) ordercount               tblorder o      inner join          tblcustomer c on .....(missing join condition again).....                o.customerid = c.customerid) x on .....(again: missing join condition here)..... order customername; 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -