sql - GROUP BY not working in left join query -
i m trying use group clause in left join sql query , not working. please me out, in advance.
select cust_mst_det.cust_hd_code, cust_mst_det.first_name, sl_head20152016.vouch_date invoice_2, sl_head20142015.vouch_date invoice_1, cust_mst_hd.email cust_mst_det left join sl_head20142015 on cust_mst_det.cust_hd_code=sl_head20142015.member_code left join sl_head20152016 on cust_mst_det.cust_hd_code=sl_head20152016.member_code left join cust_mst_hd on cust_mst_det.cust_hd_code=cust_mst_hd.cust_hd_code cust_mst_det.first_name!='nil' group cust_mst_det.cust_hd_code order sl_head20152016.vouch_date desc, sl_head20142015.vouch_date
i'm not sure dbms using, on oracle query not work @ all.
- first issue: group statement used in conjunction aggregate functions group result-set 1 or more columns. not have aggregating function in select statement (count, max, etc.)
- second issue: must specify columns select statement in group statement (excluding columns represents results of aggregation).
as said don't know db used you, 2 points should applicable of sql standards.
Comments
Post a Comment